树的后序遍历。
class Solution { public: vector<Node> Tree; void postTree(Node node) { for (auto n : node.children) { Node node; node = Node(n->val, n->children); postTree(node); } Tree.push_back(Node(node.val, node.children)); } vector<int> postorder(Node* root) { vector<int> V; if (root != NULL) { postTree(*root); } for (auto n : Tree) { V.push_back(n.val); } return V; } };