@@ -0,0 +1,1398 @@
+// Given a binary tree, return the postorder traversal of its nodes' values.%0A%0A// For example:%0A// Given binary tree %7B1,#,2,3%7D,%0A//    1%0A//     %5C%0A//      2%0A//     /%0A//    3%0A// return %5B3,2,1%5D.%0A%0A// Note: Recursive solution is trivial, could you do it iteratively?%0A%0Apublic class Solution %7B%0A    public List%3CInteger%3E postorderTraversal(TreeNode root) %7B%0A    %09List%3CInteger%3E result = new ArrayList%3CInteger%3E();%0A    %09if(root == null) return%09result;%0A%0A    %09Stack%3CTreeNode%3E stack = new Stack%3CTreeNode%3E();%0A    %09Stack%3CInteger%3E resultStack = new Stack%3CInteger%3E();%0A    %09stack.push(root);%0A%0A    %09while(!stack.isEmpty())%7B%0A    %09%09TreeNode currentNode = stack.pop();%0A    %09%09if(currentNode!=null)%7B%0A%09%09%09%09resultStack.push(currentNode.val);%0A%09%09%09%09stack.push(currentNode.left);%0A%09%09%09%09stack.push(currentNode.right); %09%09%09%0A    %09%09%7D%0A    %09%7D%0A%0A    %09while(!resultStack.isEmpty())%7B%0A    %09%09result.add(resultStack.pop());%0A    %09%7D%0A%0A    %09return result;%0A    %7D%0A    // public List%3CInteger%3E postorderTraversal(TreeNode root) %7B%0A    //     List%3CInteger%3E result = new ArrayList%3CInteger%3E();%0A    //     if(root == null)%7B%0A    //     %09return result;%0A    //     %7D%0A%0A    //     recurHelper(root, result);%0A%0A    //     return result;%0A    // %7D%0A%0A    // public void recurHelper(TreeNode node, List%3CInteger%3E result)%7B%0A    // %09if(node == null) return;%0A%0A    // %09recurHelper(node.left, result);%0A    // %09recurHelper(node.right, result);%0A    // %09result.add(node.val);%0A    // %7D%0A%7D

add binary tree postorder traversal recur/iter solution