//url:https://leetcode.com/problems/n-ary-tree-postorder-traversal/description/
/*
// Definition for a Node.
class Node {
public:
int val;
vector children;
Node() {}
Node(int _val, vector _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
vector postorder(Node* root) {
postorderEx(root);
return _res;
}
void postorderEx(Node* root){
if(!root)
return;
//std::cout<<" v="<val<children.size();i++){
postorderEx(root->children[i]);
}
_res.push_back(root->val);
}
vector _res;
};