The Order 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 a tree stored as a dict where each node name maps to {'val', 'left', 'right'} (left/right point to another node name or None) and a root node name, return True if the tree is a valid BST (strictly, no duplicates: left subtree < node < right subtree).
Summary
A binary tree has rules - is this one actually following them?
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.