Given the root of a binary tree, determine if it is a valid binary search tree. Tree is given as level-order array.
Example 1
Input: root = [5,1,4,null,null,3,6]
Output: false
Explanation: The root is 5, but its right child is 4. Everything in the right subtree must be larger than 5, so this is not a valid BST.
Example 2
Input: root = [2,1,3]
Output: true
Explanation: 1 is less than 2 and sits on the left, and 3 is greater than 2 and sits on the right, so the tree is a valid BST.
Example 3
Input: root = [1]
Output: true
Explanation: A single node is always a valid BST.
An equivalent way to phrase the BST property: an *in-order traversal* (left, root, right) yields values in strictly increasing order. So we just walk in-order tracking the previously visited value and bail out the first time we see a value that isn't strictly greater.
Run checks all cases above. Submit evaluates all test cases.