Loading...

The Balanced 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 data structure validator needs to check if a binary tree is height-balanced before using it as an index. Write a function that returns True if the tree is balanced - meaning no node has left and right subtrees whose heights differ by more than one.

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.