Given a binary tree, determine if it is a valid binary search tree (BST). Let's discuss more about some of the inputs.

Approach

We consider the approach to keep track of minimum and maximum values allowed for any node. The program performs the in-order traversal and in each recursive call, minimum and maximum range is passed. The range checks whether the current node’s value is within the given range.