Loading...

The Level Inspector

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
mid, senior

Problem

A tree visualization tool needs to group nodes by their depth for side-by-side display. Write a function that takes the root of a binary tree and returns a list of lists, where each inner list contains all node values at that depth level, left to right.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.