The Balanced Inspector
A medium Python mock interview question on DataDriven, with an AI interviewer who asks follow-up questions and a hire or no-hire decision at the end.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Interview Prompt
You're validating binary trees coming out of a parser, each given as a nested dict with keys `val`, `left`, and `right`, where a missing child is `None` and the whole tree may itself be `None`. Return whether the tree is height-balanced, meaning the heights of the left and right subtrees differ by at most one.
Summary
Every branch should carry the same weight.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write and run your Python against test cases
- Answer the interviewer's follow-up questions, then get a hire or no-hire decision