###### leetcode 145. Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes’ values.

For example:
Given binary tree {1,#,2,3},

1
\
2
/
3

return [3,2,1].

Note: Recursive solution is trivial, could you do it iteratively?

/**
* Definition for a binary tree node.
* public class TreeNode {
*     int val;
*     TreeNode left;
*     TreeNode right;
*     TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public List<Integer> postorderTraversal(TreeNode root) {
Stack<TreeNode> stack = new Stack<>();
stack.push(root);
List<Integer> ans = new ArrayList<>();
while (!stack.isEmpty()) {
TreeNode node = stack.pop();
if (node != null) {
stack.push(node.left);
stack.push(node.right);
}
}
Collections.reverse(ans);
return ans;
}
}

#### LeetCode(145)Binary Tree Postorder Traversal

2014-01-16 04:01:50

#### 【LeetCode】145. Binary Tree Postorder Traversal 解题报告

2016-05-25 00:48:57

#### Binary Tree Postorder Traversal -- LeetCode

2014-03-25 01:10:09

#### LeetCode145 Binary Tree Postorder Traversal Java题解（递归 迭代）

2015-07-09 10:34:20

#### LeetCode 145：Binary Tree Postorder Traversal（后序遍历）

2015-05-23 01:38:46

#### [leetcode-145]Binary Tree Postorder Traversal(c++)

2015-08-20 09:53:29

#### LeetCode 145 Binary Tree Postorder Traversal

2015-03-24 09:25:56

#### LeetCode 145. Binary Tree Postorder Traversal (非递归和递归解)

2014-06-02 02:19:25

#### Leetcode 145. Binary Tree Postorder Traversal

2016-02-27 09:31:03

#### 145. Binary Tree Postorder Traversal非递归，栈实现

2016-05-11 10:53:34

## 不良信息举报

leetcode 145. Binary Tree Postorder Traversal