Last active
July 26, 2019 12:47
-
-
Save alxfv/849f14ff6675727978221beb04c1d469 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isValid(node, floor, ceiling): | |
if not node: | |
return True | |
if not floor < node.val < ceiling: | |
return False | |
return isValid(node.left, floor, node.val) and isValid(node.right, node.val, ceiling) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment