Dodomeki
Sign in

71. Level Order Values

Medium

Return the values of the tree grouped by level, starting from the root and keeping left-to-right order within each level.

Example 1
Input: raiz = [3, 1, 8, null, 2, 6, 10]
Output: [[3], [1, 8], [2, 6, 10]]
Example 2
Input: raiz = []
Output: []
Constraints
  • 0 <= quantidade de nós <= 10^4
TreesBFSQueue
Caso 1
raiz =
[3,1,8,null,2,6,10]
Expected =
[[3],[1,8],[2,6,10]]
Caso 2
raiz =
[]
Expected =
[]

Run checks these 2 cases. Submit runs all 6, including hidden ones.