Skip to content

Commit b0ced89

Browse files
committed
Create README - LeetHub
1 parent 51f3d63 commit b0ced89

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2><a href="https://leetcode.com/problems/validate-binary-search-tree">98. Validate Binary Search Tree</a></h2><h3>Medium</h3><hr><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 <span data-keyword="subtree">subtree</span> of a node contains only nodes with keys <strong>less than</strong> the node&#39;s key.</li>
7+
<li>The right subtree of a node contains only nodes with keys <strong>greater than</strong> the node&#39;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 class="example">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>
15+
<strong>Input:</strong> root = [2,1,3]
16+
<strong>Output:</strong> true
17+
</pre>
18+
19+
<p><strong class="example">Example 2:</strong></p>
20+
<img alt="" src="https://assets.leetcode.com/uploads/2020/12/01/tree2.jpg" style="width: 422px; height: 292px;" />
21+
<pre>
22+
<strong>Input:</strong> root = [5,1,4,null,null,3,6]
23+
<strong>Output:</strong> false
24+
<strong>Explanation:</strong> The root node&#39;s value is 5 but its right child&#39;s value is 4.
25+
</pre>
26+
27+
<p>&nbsp;</p>
28+
<p><strong>Constraints:</strong></p>
29+
30+
<ul>
31+
<li>The number of nodes in the tree is in the range <code>[1, 10<sup>4</sup>]</code>.</li>
32+
<li><code>-2<sup>31</sup> &lt;= Node.val &lt;= 2<sup>31</sup> - 1</code></li>
33+
</ul>

0 commit comments

Comments
 (0)