[JAVA] Iterarive and recursive implements
Recursive solution (1ms beats 100%, 48.2M)\njava\nclass Solution {\n    public List<Integer> postorder(Node root) {\n        List<Integer> res = new ArrayList<>
Recursive solution (1ms beats 100%, 48.2M)\n```java\nclass Solution {\n    public List<Integer> postorder(Node root) {\n        List<Integer> res = new ArrayList<>();\n        if (root == null) return res;\n        postorder(root, res);\n        return res;\n    }\n    \n    private void postorder(Node node, List<Integer> res) {\n        for (Node c : node.children) {\n            postorder(c, res);\n        }\n        res.add(node.val);\n    }\n}\n```\n\nIterative solution(5 ms beats 22.3% 49.6M)\nhint : postorder = leftChild -> rightChild -> node;\nwhich equal to the reverse(node -> rightChild -> leftChild), which can be implemented with Stack\nHere is the code:\n```java\nclass Solution {\n    public List<Integer> postorder(Node root) {\n        Stack<Node> s = new Stack<Node>();\n        List<Integer> res = new LinkedList<>();\n        if (root != null) s.push(root);\n        while (! s.isEmpty()) {\n            Node n = s.pop();\n            res.add(n.val);\n            for (Node c : n.children) {\n                s.push(c);\n            }\n        }\n        Collections.reverse(res);\n        return res;\n    }\n}\n```\n
['Java']