You are viewing a single comment's thread. Return to all comments →
Single line solution
def checkBST(root, min_v =-1 , max_v = 10001): return True if root is None else (root.data < max_v and root.data > min_v and checkBST(root.left, min_v, root.data) and checkBST(root.right,root.data, max_v))
Seems like cookies are disabled on this browser, please enable them to open this website
Trees: Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
Single line solution