Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class binarytree:
def __init__(self, val):
self.val = val
self.leftnode = leftnode
self.rightnode = rightnode
import sys
class BinarySearchTree:
def validate_BST(self, root: binarytree) -> bool:
return self.valid(root, sys.maxsize, -sys.maxsize)
def valid(self, root, max_, min_):
if root == None:
return True
return False
return self.valid(root.leftnode, root.val, min_) and self.valid(root.rightnode, max_, root.val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment