N-ary Tree Preorder Traversal
Given an n-ary tree, return thepreordertraversal of its nodes' values. For example, given a3-arytree:

Return its preorder traversal as:[1,3,5,6,2,4].
Note: Recursive solution is trivial, could you do it iteratively?
Solution
Last updated
Was this helpful?