Given the root of a binary tree, determine if it is a valid binary search tree (BST): every node's left subtree contains only values strictly less than the node's value, and every right subtree contains only values strictly greater, recursively.
Input: root = [2,1,3]
Output: true
Topics: trees, binary-search
Asked by: Amazon, Meta, Microsoft, Google, Bloomberg
Time complexity: O(n). Space complexity: O(h).