mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 03:11:42 +08:00
存量题库数据更新
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<p>给定一个二叉搜索树的 <strong>根节点</strong> <code>root</code> 和一个整数 <code>k</code> , 请判断该二叉搜索树中是否存在两个节点它们的值之和等于 <code>k</code> 。假设二叉搜索树中节点的值均唯一。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入: </strong>root =<strong> </strong>[8,6,10,5,7,9,11], k = 12
|
||||
<strong>输出: </strong>true
|
||||
<strong>解释: </strong>节点 5 和节点 7 之和等于 12
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入: </strong>root =<strong> </strong>[8,6,10,5,7,9,11], k = 22
|
||||
<strong>输出: </strong>false
|
||||
<strong>解释: </strong>不存在两个节点值之和为 22 的节点
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li>二叉树的节点个数的范围是 <code>[1, 10<sup>4</sup>]</code>.</li>
|
||||
<li><code>-10<sup>4</sup> <= Node.val <= 10<sup>4</sup></code></li>
|
||||
<li><code>root</code> 为二叉搜索树</li>
|
||||
<li><code>-10<sup>5</sup> <= k <= 10<sup>5</sup></code></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p>注意:本题与主站 653 题相同: <a href="https://leetcode-cn.com/problems/two-sum-iv-input-is-a-bst/">https://leetcode-cn.com/problems/two-sum-iv-input-is-a-bst/</a></p>
|
Reference in New Issue
Block a user