We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 00617e5 commit 8db25f0Copy full SHA for 8db25f0
invert_binary_tree.py
@@ -0,0 +1,12 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+class Solution:
4
+ # @param root: a TreeNode, the root of the binary tree
5
+ # @return: nothing
6
+ def invertBinaryTree(self, root):
7
+ # write your code here
8
+ if root is None:
9
+ return
10
+ root.left, root.right = root.right, root.left
11
+ self.invertBinaryTree(root.left)
12
+ self.invertBinaryTree(root.right)
0 commit comments