Binary Tree Level Order Traversal (easy)

Problem Statement

Given a binary tree, populate an array to represent its level-by-level traversal. You should populate the values of all nodes of each level from left to right in separate sub-arrays.

Example 1:

Image

Example 2:

Image

Try it yourself

Try solving this question here:

NaN
NaN

LOADING....
. . .