Is a Binary Search Tree Valid?
Given a binary tree, determine whether it's a valid binary search tree.
Statement
Given a binary tree, figure out whether it’s a valid binary search tree.
In a BST, each node’s key value is smaller than the key value of the right subtree nodes and greater than the key values of the left subtree nodes.
Example
The following binary tree is an example of a valid BST:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.