💯 Iterative Solution | Stack Based  | Reversal | O(n) 💯
Intuition\n Describe your first thoughts on how to solve this problem. \nPostorder: (Left->Right->Self) \nis reverse of (Self->Right->Left)\n\n(Self->Right->Lef
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nPostorder: (Left->Right->Self) \nis reverse of (Self->Right->Left)\n\n(Self->Right->Left) is just Preorder but with rightmost children visited first, then left.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nConduct **modified** preorder of N-ary tree like [Question 589. N-ary Tree Preorder Traversal](https://leetcode.com/problems/n-ary-tree-preorder-traversal/)\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> postorder(Node* root) {\n        //Postorder(Left->Right->Self) is reverse of Modified PreOrder(Self->Right->Left)\n        if(!root) return {};\n        stack<Node*> st;\n        st.push(root);\n        vector<int> ans;\n        while(!st.empty())\n        {\n            Node* nd=st.top(); st.pop();\n            int size=nd->children.size();\n            ans.push_back(nd->val);\n            for(int i=0;i<size;i++)\n            {\n                if(nd->children[i])st.push(nd->children[i]);\n            }\n        }\n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```
['Stack', 'Tree', 'Depth-First Search', 'Recursion', 'C++']