N-ary Tree Preorder Traversal LeetCode solution in JavaScript

1
var preorder = function (root) {
2
return [root.val].concat(
3
root.children.map((c) => (c ? preorder(c) : [])).flat()
4
);
5
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0