Back to DSA sheet

Validate Binary Search Tree

MediumBST
Open on LeetCodeAmazonGoogle

Return true if a binary tree is a valid binary search tree, where every node sits within the value range allowed by its ancestors.

Constraints
  • 1 <= nodes <= 10^4
  • -2^31 <= Node.val <= 2^31 - 1
Sheets
Blind 75Grind 75NeetCode 150NeetCode 250
validate-binary-search-tree.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.