mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part2
This commit is contained in:
27
算法题(国内版)/problem (Chinese)/后继者 [successor-lcci].html
Normal file
27
算法题(国内版)/problem (Chinese)/后继者 [successor-lcci].html
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>设计一个算法,找出二叉搜索树中指定节点的“下一个”节点(也即中序后继)。</p>
|
||||
|
||||
<p>如果指定节点没有对应的“下一个”节点,则返回<code>null</code>。</p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong> root = <code>[2,1,3], p = 1
|
||||
|
||||
2
|
||||
/ \
|
||||
1 3
|
||||
</code>
|
||||
<strong>输出:</strong> 2</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong> root = <code>[5,3,6,2,4,null,null,1], p = 6
|
||||
|
||||
5
|
||||
/ \
|
||||
3 6
|
||||
/ \
|
||||
2 4
|
||||
/
|
||||
1
|
||||
</code>
|
||||
<strong>输出:</strong> null</pre>
|
Reference in New Issue
Block a user