Back to DSA
Binary Tree Level Order Traversal
mediumPerform a breadth-first traversal of a binary tree and return the node values grouped by depth level. Each level's values should be listed from left to right.
Examples
Example 1:
Input:
root = [10,5,15,3,7,null,20]Output:
[[10],[5,15],[3,7,20]] Example 2:
Input:
root = [42]Output:
[[42]]Hints
1234567