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 1873f73 commit 4b3c581Copy full SHA for 4b3c581
145_Binary_Tree_Postorder_Traversal.py
@@ -0,0 +1,22 @@
1
+# Definition for a binary tree node.
2
+# class TreeNode(object):
3
+# def __init__(self, x):
4
+# self.val = x
5
+# self.left = None
6
+# self.right = None
7
+
8
+class Solution(object):
9
+ def postorderTraversal(self, root):
10
+ """
11
+ :type root: TreeNode
12
+ :rtype: List[int]
13
14
+ result = []
15
+ def postorder(root,result):
16
+ if not root:
17
+ return
18
+ postorder(root.left,result)
19
+ postorder(root.right,result)
20
+ result.append(root.val)
21
+ postorder(root,result)
22
+ return result
0 commit comments