1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/后继者 [successor-lcci].html
2025-01-09 20:29:41 +08:00

30 lines
577 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>