Easy
False
python3
class Solution:
def isBalanced(self, root: TreeNode) -> bool:
res = []
def dfs(node, h):
if node is None:
return h
lh = dfs(node.left, h+1)
rh = dfs(node.right, h+1)
if abs(lh - rh) > 1:
res.append(False)
else:
res.append(True)
return max(lh,rh)
dfs(root,0)
return False not in res