[原题链接](https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/solution/qian-duan-shi-tang-ti-jie-chao-hao-li-ji-dpjn/) ## 递归 dfs ```javascript const postorder = function(root) { if (root === null) return [] const res = [] function dfs(root) { if (root === null) return; for (let i = 0; i < root.children.length; i++){ dfs(root.children[i]) } res.push(root.val) } dfs(root) return res } ``` - 时间复杂度: O(n) - 空间复杂度: O(n)