Medium

Quiz

#102 Binary Tree Level Order Traversal

APPROACH

Given the root of a binary tree, collect node values level by level from top to bottom, left to right, and return them as a list of lists.

Example 1:

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

Example 2:

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

Example 3:

Input: root = []
Output: []
1 of 4
1:00

What is the optimal approach for this problem?