File tree Expand file tree Collapse file tree 1 file changed +0
-23
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .fishercoder .common .classes .TreeNode ;
4
4
5
- /**
6
- * 98. Validate Binary Search Tree
7
- *
8
- * Given a binary tree, determine if it is a valid binary search tree (BST).
9
-
10
- Assume a BST is defined as follows:
11
-
12
- The left subtree of a node contains only nodes with keys less than the node's key.
13
- The right subtree of a node contains only nodes with keys greater than the node's key.
14
- Both the left and right subtrees must also be binary search trees.
15
-
16
- Example 1:
17
- 2
18
- / \
19
- 1 3
20
- Binary tree [2,1,3], return true.
21
-
22
- Example 2:
23
- 1
24
- / \
25
- 2 3
26
- Binary tree [1,2,3], return false.
27
- */
28
5
public class _98 {
29
6
30
7
public static class Solution1 {
You can’t perform that action at this time.
0 commit comments