题目,590. N-ary Tree Postorder Traversal 解析 n叉树的后序遍历,左->右->根 1234567891011 var postorder = function(root) { const res = []; if(!root) { return []; } for(let i=0; i<root.children.length; i++) { res.push(...postorder(root.children[i])); } res.push(root.val); return res;}; 赞微海报分享
近期评论