Validate Binary Search Tree
Return true if a tree is a valid BST: every node's value must be strictly greater than all values in its left subtree and strictly less than all values in its right subtree, not just its immediate children. That's the classic trap: a node can look locally fine (bigger than its left child, smaller than its right) while still violating an ancestor's bound.
Carry a valid (min, max) range down through the recursion.
isValidBST(tree([2, 1, 3])); // true
isValidBST(tree([5, 1, 4, null, null, 3, 6])); // false, 3 is under 5's right subtree but 3 < 5