mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 03:11:42 +08:00
批量更新数据
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
<p>例如,给定如下二叉树: root = [3,5,1,6,2,0,8,null,null,7,4]</p>
|
||||
|
||||
<pre> 3
|
||||
<pre>
|
||||
3
|
||||
/ \
|
||||
5 1
|
||||
/ \ / \
|
||||
@@ -11,19 +12,22 @@
|
||||
7 4
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1
|
||||
<strong>输出:</strong> 3
|
||||
<strong>解释:</strong> 节点 5 和节点 1 的最近公共祖先是节点 3。</pre>
|
||||
<pre>
|
||||
<strong>输入:</strong>root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1
|
||||
<strong>输出:</strong>3
|
||||
<strong>解释:</strong>节点 5 和节点 1 的最近公共祖先是节点 3。</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 4
|
||||
<strong>输出:</strong> 5
|
||||
<strong>解释:</strong> 节点 5 和节点 4 的最近公共祖先是节点 5。因为根据定义最近公共祖先节点可以为节点本身。</pre>
|
||||
<pre>
|
||||
<strong>输入:</strong>root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 4
|
||||
<strong>输出:</strong>5
|
||||
<strong>解释:</strong>节点 5 和节点 4 的最近公共祖先是节点 5。因为根据定义最近公共祖先节点可以为节点本身。</pre>
|
||||
|
||||
<p><strong>说明:</strong></p>
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<pre>所有节点的值都是唯一的。
|
||||
<pre>
|
||||
所有节点的值都是唯一的。
|
||||
p、q 为不同节点且均存在于给定的二叉树中。</pre>
|
||||
|
Reference in New Issue
Block a user