Skip to content

Commit 2e73b2a

Browse files
committed
Time: 48 ms (55.21%), Space: 16.4 MB (33.99%) - LeetHub
1 parent 7e920df commit 2e73b2a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
3+
if not root: return root
4+
leftSide = root.left
5+
root.left = self.invertTree(root.right)
6+
root.right = self.invertTree(leftSide)
7+
return root

0 commit comments

Comments
 (0)