Java solution using stack
public List<Integer> postorderTraversal(TreeNode root) {\n      List<Integer> res = new ArrayList<Integer>();\n      \n      if (root == null)\n        return r
    public List<Integer> postorderTraversal(TreeNode root) {\n      List<Integer> res = new ArrayList<Integer>();\n      \n      if (root == null)\n        return res;\n          \n      Stack<TreeNode> stack = new Stack<TreeNode>();\n      stack.push(root);\n      \n      while (!stack.isEmpty()) {\n        TreeNode node = stack.pop();\n        res.add(node.val);\n        \n        if (node.right != null)\n          stack.push(node.right);\n            \n        if (node.left != null)\n          stack.push(node.left);\n      }\n      \n      return res;\n    }
['Java']