Problem · Tree
Validate Binary Search Tree
Learn this problemProblem statement
Return whether the binary tree is a valid binary search tree. Every value in a left subtree must be strictly smaller than its ancestor, and every value in a right subtree must be strictly larger.
Function
isValidBST(root: TreeNode) → booleanExamples
Example 1
root = [2,1,3]return = trueBoth children satisfy the strict bounds imposed by the root.
Constraints
- The tree contains between
1and10000nodes. - Node values fit in a signed 32-bit integer.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024