50. Binary Tree Level Order Traversal

Return the node values level by level, from left to right.

Example 1

Input: root = [3,9,20,null,null,15,7]
Output: [[3],[9,20],[15,7]]

Example 2

Input: root = [1]
Output: [[1]]
Hint 1

Breadth-first search with a queue.

Hint 2

Process the queue in batches of its current size: one batch = one level.

TreeBFS