We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d686fd commit 59f1192Copy full SHA for 59f1192
invert-binary-tree/printjin-gmailcom.py
@@ -0,0 +1,8 @@
1
+class Solution:
2
+ def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
3
+ if not root:
4
+ return None
5
+ root.left, root.right = root.right, root.left
6
+ self.invertTree(root.left)
7
+ self.invertTree(root.right)
8
+ return root
0 commit comments