Skip to content

Commit 2b2be5a

Browse files
committed
[Problem 145] Binary Tree Postorder Traversal
1 parent c546635 commit 2b2be5a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package easy
2+
3+
/**
4+
* Given the root of a binary tree, return the postorder traversal of its nodes' values.
5+
6+
7+
8+
Example 1:
9+
10+
11+
Input: root = [1,null,2,3]
12+
Output: [3,2,1]
13+
Example 2:
14+
15+
Input: root = []
16+
Output: []
17+
Example 3:
18+
19+
Input: root = [1]
20+
Output: [1]
21+
22+
23+
Constraints:
24+
25+
The number of the nodes in the tree is in the range [0, 100].
26+
-100 <= Node.val <= 100
27+
28+
29+
Follow up: Recursive solution is trivial, could you do it iteratively?
30+
*/
31+
32+
fun postorderTraversal(root: TreeNode?): List<Int> {
33+
34+
}

0 commit comments

Comments
 (0)