Problem statement

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

Input

The input will be a binary tree, and you will be provided with its root node. The following is an example input:

    3
   / \
  9  20
    /  \
   15   7

Output

The output will be ...

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Devpath's Terms of Service and Privacy Policy