You are viewing a single comment's thread. Return to all comments →
Wow thanks! I wrote it in Python and it worked for all test cases!
def check_binary_search_tree_(root): return checkBST(root, -1, 10001) def checkBST(root, Min, Max): if not root: return True if root.data <= Min or root.data >= Max: return False return checkBST(root.left, Min, root.data) and checkBST(root.right, root.data, Max)
Seems like cookies are disabled on this browser, please enable them to open this website
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
Wow thanks! I wrote it in Python and it worked for all test cases!