The Order 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
We store a binary tree as a dict mapping each node name to its value and its left and right children (each another node name or None), along with the name of the root. Return whether it is a valid binary search tree: every value in a node's left subtree smaller than that node, and every value in its right subtree larger.
Summary
A binary tree has rules - is this one actually following them?
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