Visualize BST validation step by step. Watch the min/max bounds narrow at each recursion level to catch violations that a simple parent-child check would miss.
Check that every node satisfies the BST invariant: left subtree values < node < right subtree values, for ALL ancestors and not just the immediate parent.
Checking only node.left.val < node.val < node.right.val is NOT enough. A node can violate its grandparent's constraint.
Pass a valid range (min, max) down the recursion. The root has range (-∞, +∞). Going left narrows the max to the current value; going right narrows the min.
If any node's value falls outside its allowed range, the tree is invalid. Mark it in red and short-circuit.
O(N), because every node is visited exactly once. O(h) space for the recursion stack.
LeetCode 98. An alternative approach: inorder traversal should produce a strictly increasing sequence. Both approaches are O(N).