Skip to content

Commit 431bdd3

Browse files
author
Joseph Luce
authored
Update 110_balanced_binary_tree.md
1 parent 3629f00 commit 431bdd3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

leetcode/easy/110_balanced_binary_tree.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ However, no matter what, we will end up using at most O(H) space to traverse the
1515
```
1616
class Solution:
1717
def isBalanced(self, root: TreeNode) -> bool:
18-
18+
1919
def balance_helper(root):
2020
if root is None:
2121
return 0
2222
left = balance_helper(root.left)
2323
right = balance_helper(root.right)
2424
if left == -1 or right == -1:
2525
return -1
26-
return max(left+1, right+1) if abs(left-right) <= 1 else -1
27-
26+
return max(left, right)+1 if abs(left-right) <= 1 else -1
27+
2828
return balance_helper(root) != -1
2929
```

0 commit comments

Comments
 (0)