137. N-ary Tree Level Order Traversal

Given the root of an n-ary tree root, return the node values level by level from left to right (breadth-first traversal). The tree is given in the format: [root, null, root_children, null, next_node_children, ...].
Example 1
Input: root = [1,null,3,2,4,null,5,6]
Output: [[1],[3,2,4],[5,6]]
Explanation: Three levels: root, three children, two leaves.
Example 2
Input: root = [1]
Output: [[1]]
Explanation: Tree with a single node.
mediumn-ary treequeuetree
JavaScript
Loading...
Line 1, Char 1