Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Validate Binary Search Tree
1
isValidBST(Node(2))
Valid BST (Simple)
Invalid BST (Example)
Invalid BST (Subtle)
Valid BST (Complex)
Custom
tree
=
[2, 1, 3]
2
1
3
range
every node must fit in an open range (min, max)
Step:
Start: every node must lie in an open range (min, max); the root starts with (-Infinity, +Infinity)
0 / 24
Valid BST (Simple)
Invalid BST (Example)
Invalid BST (Subtle)
Valid BST (Complex)
Custom
tree
=
[2, 1, 3]
0 / 24
2
1
3
range
every node must fit in an open range (min, max)
Step:
Start: every node must lie in an open range (min, max); the root starts with (-Infinity, +Infinity)
1
isValidBST(Node(2))