There was an error while loading. Please reload this page.
原题链接
const preorder = function(root) { if (root === null) return [] const res = [] function dfs(root) { if (root === null) return res.push(root.val) for (let i = 0; i < root.children.length; i++) { dfs(root.children[i]) } } dfs(root) return res }