Your question is Validate Binary Search Tree. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
At Dropbox, a service stores ordered values in a binary tree and needs to verify that the structure satisfies binary search tree rules. Given the root of a binary tree, implement a function that returns True if it is a valid binary search tree (BST), otherwise return False.
A valid BST must satisfy all of the following:
root, the root node of a binary tree represented as nested dictionaries or null.def is_valid_bst(root=None, **kwargs):