标签:src span help image turn return tree img tco
题目描述:
提交:
class Solution: def goodNodes(self, root: TreeNode) -> int: def helper(m,node): r,left,right = 0,0,0 if node.val >= m: r = 1 if node.left: left = helper(max(m,node.val),node.left) if node.right: right = helper(max(m,node.val),node.right) return r + left + right if not root: return 0 return helper(root.val,root)
leetcode-26双周赛-5398-统计二叉树中好结点的数目
标签:src span help image turn return tree img tco
原文地址:https://www.cnblogs.com/oldby/p/12904772.html