Skip to content

Commit 74c1a0d

Browse files
committedMar 5, 2021
Create README - LeetHub
1 parent f7abc68 commit 74c1a0d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
 

‎validate-binary-search-tree/README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h2>98. Validate Binary Search Tree</h2><h3>Medium</h3><hr><div><p>Given the <code>root</code> of a binary tree, <em>determine if it is a valid binary search tree (BST)</em>.</p>
2+
3+
<p>A <strong>valid BST</strong> is defined as follows:</p>
4+
5+
<ul>
6+
<li>The left subtree of a node contains only nodes with keys <strong>less than</strong> the node's key.</li>
7+
<li>The right subtree of a node contains only nodes with keys <strong>greater than</strong> the node's key.</li>
8+
<li>Both the left and right subtrees must also be binary search trees.</li>
9+
</ul>
10+
11+
<p>&nbsp;</p>
12+
<p><strong>Example 1:</strong></p>
13+
<img alt="" src="https://assets.leetcode.com/uploads/2020/12/01/tree1.jpg" style="width: 302px; height: 182px;">
14+
<pre><strong>Input:</strong> root = [2,1,3]
15+
<strong>Output:</strong> true
16+
</pre>
17+
18+
<p><strong>Example 2:</strong></p>
19+
<img alt="" src="https://assets.leetcode.com/uploads/2020/12/01/tree2.jpg" style="width: 422px; height: 292px;">
20+
<pre><strong>Input:</strong> root = [5,1,4,null,null,3,6]
21+
<strong>Output:</strong> false
22+
<strong>Explanation:</strong> The root node's value is 5 but its right child's value is 4.
23+
</pre>
24+
25+
<p>&nbsp;</p>
26+
<p><strong>Constraints:</strong></p>
27+
28+
<ul>
29+
<li>The number of nodes in the tree is in the range <code>[1, 10<sup>4</sup>]</code>.</li>
30+
<li><code>-2<sup>31</sup> &lt;= Node.val &lt;= 2<sup>31</sup> - 1</code></li>
31+
</ul>
32+
</div>

0 commit comments

Comments
 (0)
Please sign in to comment.