Re: [闲聊] 每日leetcode

楼主: DJYOMIYAHINA (通通打死)   2024-08-26 08:38:43
剩easy能给我一点信心了
今天想这题花了38分钟
void helper(Node* root, vector<int>& ans) {
if(!root) {
return;
}
for(auto n : root->children) {
helper(n, ans);
}
ans.push_back(root->val);
}
vector<int> postorder(Node* root) {
vector<int> ans;
helper(root, ans);
return ans;
}
作者: Smallsh (Smallsh)   2024-08-26 08:40:00
大师
作者: JerryChungYC (JerryChung)   2024-08-26 09:14:00
剩我不会了

Links booklink

Contact Us: admin [ a t ] ucptt.com