Skip to content

Commit 3ad031a

Browse files
authored
Update README.md
1 parent d5ccb1b commit 3ad031a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11
# Validate a Binary Search Tree(BST)
2+
# https://leetcode.com/problems/validate-binary-search-tree
23

4+
Given a binary tree, determine if it is a valid binary search tree (BST).
35

6+
Assume a BST is defined as follows:
7+
8+
The left subtree of a node contains only nodes with keys less than the node's key.
9+
The right subtree of a node contains only nodes with keys greater than the node's key.
10+
Both the left and right subtrees must also be binary search trees.
11+
12+
```
13+
Example 1:
14+
15+
2
16+
/ \
17+
1 3
18+
19+
Input: [2,1,3]
20+
Output: true
21+
22+
Example 2:
23+
24+
5
25+
/ \
26+
1 4
27+
/ \
28+
3 6
29+
30+
Input: [5,1,4,null,null,3,6]
31+
Output: false
32+
Explanation: The root node's value is 5 but its right child's value is 4.
33+
```
434
# Implementation :
535

636
```java

0 commit comments

Comments
 (0)