0429. Level Order Traversal
Medium | Tree + Recursion / Stack | 32 ms (98.53%), 16.3 MB (96.69%)
Source: LeetCode - N-ary Tree Level Order Traversal GitHub: Solution / Performance
Given an n-ary tree, return the level order traversal of its nodes' values.
Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).
For the recursive solution, we need to record the extra information 'Level' in each iteration.
Then, based on the different levels in each recursion, we append the node's value to different lists.
Last updated