Skip to content

Commit

Permalink
re-solve "226. Invert Binary Tree"
Browse files Browse the repository at this point in the history
  • Loading branch information
lancelote committed Nov 4, 2024
1 parent 0014084 commit bf80ec2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/invert_binary_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

class Solution:
def invertTree(self, root: TreeNode | None) -> TreeNode | None:
if not root:
if root is None:
return None

root.left, root.right = root.right, root.left

self.invertTree(root.left)
self.invertTree(root.right)

Expand Down

0 comments on commit bf80ec2

Please sign in to comment.