https://leetcode.com/problems/n-ary-tree-postorder-traversal/description/
/*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
vector<int> res;
vector<int> postorder(Node* root) {
if(root!=NULL){
for(auto n:root->children){
postorder(n);
}
res.push_back(root->val);
}
return res;
}
};