标签:not tco pytho 用户 python tree lan info style
class Solution: def isBalanced(self, root: TreeNode) -> bool: if not root: return True def helper(node): if not node: return 0 left=helper(node.left) right=helper(node.right) return max(left,right)+1 return abs(helper(root.left)-helper(root.right))<=1 and self.isBalanced(root.left) and self.isBalanced(root.right)
标签:not tco pytho 用户 python tree lan info style
原文地址:https://www.cnblogs.com/taoyuxin/p/11865355.html