the idea is to convert the problem to (root, right, left) with add first into the linkedlist.

```
public class Solution {
public List<Integer> postorderTraversal(TreeNode root) {
LinkedList<Integer> result = new LinkedList<>();
if (root == null) return result;
TreeNode curr = root;
Stack<TreeNode> stack = new Stack<>();
stack.push(curr);
while (!stack.isEmpty()) {
curr = stack.pop();
result.addFirst(curr.val);
if (curr.left != null ) stack.push(curr.left);
if (curr.right !=null ) stack.push(curr.right);
}
return result;
}
}
```