write a function to check the validity of a binary search tree
Anonymous
Recursion. - checkTree(TreeNode* root, int upperLimit, int lowerLimit) - initially, set upperLimit to INT_MAX and lowerlimit to INT_MIN; - Whenever you go left, update the upperLimit to the current node value - Whenever you go right, update the lowerLimit to the current node value - At each level, check that the current node value is between the upper and lower limits. If a node doesn't fit this criteria, return false
Check out your Company Bowl for anonymous work chats.