S
All challenges
Practice
Home
Blog
Practice
Examples
Feedback
Level Order Traversal (BFS)
00:00
Start
00:00
Sign in
Problem
Hints
3
Solution
History
Medium
Tree
BFS
Queue
Level Order
Amazon
Microsoft
Return binary tree node values grouped level by level (BFS). Return a list of lists.
Examples
Example 1
Input →
[3,9,20,null,null,15,7]
Output →
[[3],[9,20],[15,7]]
Example 2
Input →
[1]
Output →
[[1]]
Example 3
Input →
[]
Output →
[]
JavaScript
Python
Java (Coming soon)
C (Coming soon)
C++ (Coming soon)
Reset
Run
Submit
Cases
Results