Python, C++ and Java Recursive & Iterative Solution
Python recursive solution\n\npython\nclass Solution(object):\n    def postorder(self, root):\n        """\n        :type root: Node\n        :rtype: List[int]\n
**Python recursive solution**\n\n```python\nclass Solution(object):\n    def postorder(self, root):\n        """\n        :type root: Node\n        :rtype: List[int]\n        """\n        result = []\n        if root != None:\n            res = []\n            for child in root.children:\n                res += self.postorder(child)\n            result += res\n            result.append(root.val)\n        return result\n\n```\n\n**Python iterative solution**\n\n```\nclass Solution(object):\n    def postorder(self, root):\n        """\n        :type root: Node\n        :rtype: List[int]\n        """\n        stack, res = [root], []\n        while len(stack) != 0 and root != None:\n            n = stack.pop()\n            res.insert(0, n.val)\n            stack += n.children\n        return res\n```\n\n**C++ recursive solution**\n\n```cpp\nclass Solution {\npublic:\n    vector<int> postorder(Node* root) {\n        vector<int> result;\n        if (root) {\n            vector<int> res;\n            for (auto & ch : root->children) {\n                vector<int> r = postorder(ch);\n                res.insert(res.end(), r.begin(), r.end());\n            }\n            result.insert(result.end(), res.begin(), res.end());\n            result.push_back(root->val);\n        }\n        return result;\n    }\n};\n```\n\n**C++ iterative solution**\n\n```cpp\nclass Solution {\npublic:\n    vector<int> postorder(Node* root) {\n        stack<Node*> s; s.push(root);\n        vector<int> result;\n        while (!s.empty() && root) {\n            Node * n = s.top(); s.pop();\n            result.insert(result.begin(), n->val);\n            for (auto & ch : n->children) s.push(ch);\n        }\n        return result;\n    }\n};\n```\n\n**Java recursive solution**\n\n```java\nclass Solution {\n    public List<Integer> postorder(Node root) {\n        List<Integer> result = new LinkedList<>();\n        if (root != null) {\n            List<Integer> res = new LinkedList<>();\n            for (Node n : root.children) res.addAll(postorder(n));\n            result.addAll(res);\n            result.add(root.val);\n        }\n        return result;\n    }\n}\n```\n\n\n**Java iterative solution**\n\n```java\nclass Solution {\n    public List<Integer> postorder(Node root) {\n        List<Integer> result = new LinkedList<>();\n        Stack<Node> stack = new Stack<>(); stack.push(root);\n        while (!stack.empty() && root != null) {\n            Node node = stack.pop();\n            result.add(0, node.val);\n            for (Node n : node.children) stack.push(n);\n        }\n        return result;\n    }\n}\n```
[]