mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-09 09:21:40 +08:00
23 lines
480 B
HTML
23 lines
480 B
HTML
<p>实现一个函数,检查一棵二叉树是否为二叉搜索树。</p>
|
||
<strong>示例 1:</strong>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>
|
||
2
|
||
/ \
|
||
1 3
|
||
<strong>输出:</strong>true
|
||
</pre>
|
||
<strong>示例 2:</strong>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>
|
||
5
|
||
/ \
|
||
1 4
|
||
/ \
|
||
3 6
|
||
<strong>输出:</strong>false
|
||
<strong>解释:</strong>输入为: [5,1,4,null,null,3,6]。
|
||
根节点的值为 5 ,但是其右子节点值为 4 。</pre>
|