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
- L4
Problem
Given the root of a binary tree (nested dict with 'val', 'left', 'right'; subtrees are dicts or None), return a list where position i is the list of values at depth i (root = depth 0), in left-to-right order.
Summary
Each floor of the tower tells a different story.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.