Validate Binary Search Tree
Problem Given the root of a binary tree, determine whether it is a valid BST: every node's key exceeds all keys in its left subtree and is less than all keys in its right subtree.
Input / Output
- Input: tree root. Output: boolean.
Constraints
- Up to 10^4 nodes; keys may equal INT_MIN/INT_MAX — bounds handling matters (use long or nullable bounds).
Example
- [5,1,4,null,null,3,6] → false (3 in the right subtree violates 5, though it's a valid child of 4 locally).
asked …