The algorithm: Create a helper function isValid(node, min, max) Base case: if node is null, return true Check if node.val is within (min, max). If not, return false. Recurse on left with range (min, node.val) Recurse on right with range (node.val, max) Start with root and range (-∞, +∞) The ranges narrow as you go down the tree.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/maang-interview-prep/trees-bst/validate-binary-search-tree-solution
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████████████████████████████████████████████████████████████████████████████████████