Skip to content

Commit 678337b

Browse files
committed
fix: update README.md
1 parent 5028426 commit 678337b

File tree

111 files changed

+222
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+222
-4
lines changed

lcci/01.01.Is Unique/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.01. 判定字符是否唯一](https://leetcode-cn.com/problems/is-unique-lcci)
22

3+
[English Version](/lcci/01.01.Is%20Unique/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>实现一个算法,确定一个字符串 <code>s</code> 的所有字符是否全都不同。</p>

lcci/01.02.Check Permutation/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.02. 判定是否互为字符重排](https://leetcode-cn.com/problems/check-permutation-lcci)
22

3+
[English Version](/lcci/01.02.Check%20Permutation/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定两个字符串 <code>s1</code> 和 <code>s2</code>,请编写一个程序,确定其中一个字符串的字符重新排列后,能否变成另一个字符串。</p>

lcci/01.03.String to URL/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.03. URL化](https://leetcode-cn.com/problems/string-to-url-lcci)
22

3+
[English Version](/lcci/01.03.String%20to%20URL/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>URL化。编写一种方法,将字符串中的空格全部替换为<code>%20</code>。假定该字符串尾部有足够的空间存放新增字符,并且知道字符串的&ldquo;真实&rdquo;长度。(注:用<code>Java</code>实现的话,请使用字符数组实现,以便直接在数组上操作。)</p>

lcci/01.04.Palindrome Permutation/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.04. 回文排列](https://leetcode-cn.com/problems/palindrome-permutation-lcci)
22

3+
[English Version](/lcci/01.04.Palindrome%20Permutation/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定一个字符串,编写一个函数判定其是否为某个回文串的排列之一。</p>

lcci/01.05.One Away/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.05. 一次编辑](https://leetcode-cn.com/problems/one-away-lcci)
22

3+
[English Version](/lcci/01.05.One%20Away/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>字符串有三种编辑操作:插入一个字符、删除一个字符或者替换一个字符。 给定两个字符串,编写一个函数判定它们是否只需要一次(或者零次)编辑。</p>

lcci/01.06.Compress String/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.06. 字符串压缩](https://leetcode-cn.com/problems/compress-string-lcci)
22

3+
[English Version](/lcci/01.06.Compress%20String/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>字符串压缩。利用字符重复出现的次数,编写一种方法,实现基本的字符串压缩功能。比如,字符串<code>aabcccccaaa</code>会变为<code>a2b1c5a3</code>。若“压缩”后的字符串没有变短,则返回原先的字符串。你可以假设字符串中只包含大小写英文字母(a至z)。</p>

lcci/01.07.Rotate Matrix/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.07. 旋转矩阵](https://leetcode-cn.com/problems/rotate-matrix-lcci)
22

3+
[English Version](/lcci/01.07.Rotate%20Matrix/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定一幅由N × N矩阵表示的图像,其中每个像素的大小为4字节,编写一种方法,将图像旋转90度。</p>

lcci/01.08.Zero Matrix/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.08. 零矩阵](https://leetcode-cn.com/problems/zero-matrix-lcci)
22

3+
[English Version](/lcci/01.08.Zero%20Matrix/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>编写一种算法,若M × N矩阵中某个元素为0,则将其所在的行与列清零。</p>

lcci/01.09.String Rotation/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 01.09. 字符串轮转](https://leetcode-cn.com/problems/string-rotation-lcci)
22

3+
[English Version](/lcci/01.09.String%20Rotation/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>字符串轮转。给定两个字符串<code>s1</code>和<code>s2</code>,请编写代码检查<code>s2</code>是否为<code>s1</code>旋转而成(比如,<code>waterbottle</code>是<code>erbottlewat</code>旋转后的字符串)。</p>

lcci/02.01.Remove Duplicate Node/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.01. 移除重复节点](https://leetcode-cn.com/problems/remove-duplicate-node-lcci)
22

3+
[English Version](/lcci/02.01.Remove%20Duplicate%20Node/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>编写代码,移除未排序链表中的重复节点。保留最开始出现的节点。</p>

lcci/02.02.Kth Node From End of List/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.02. 返回倒数第 k 个节点](https://leetcode-cn.com/problems/kth-node-from-end-of-list-lcci)
22

3+
[English Version](/lcci/02.02.Kth%20Node%20From%20End%20of%20List/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>实现一种算法,找出单向链表中倒数第 k 个节点。返回该节点的值。</p>

lcci/02.03.Delete Middle Node/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.03. 删除中间节点](https://leetcode-cn.com/problems/delete-middle-node-lcci)
22

3+
[English Version](/lcci/02.03.Delete%20Middle%20Node/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>实现一种算法,删除单向链表中间的某个节点(除了第一个和最后一个节点,不一定是中间节点),假定你只能访问该节点。</p>

lcci/02.04.Partition List/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.04. 分割链表](https://leetcode-cn.com/problems/partition-list-lcci)
22

3+
[English Version](/lcci/02.04.Partition%20List/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>编写程序以 x 为基准分割链表,使得所有小于 x 的节点排在大于或等于 x 的节点之前。如果链表中包含 x,x 只需出现在小于 x 的元素之后(如下所示)。分割元素 x 只需处于&ldquo;右半部分&rdquo;即可,其不需要被置于左右两部分之间。</p>

lcci/02.05.Sum Lists/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.05. 链表求和](https://leetcode-cn.com/problems/sum-lists-lcci)
22

3+
[English Version](/lcci/02.05.Sum%20Lists/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定两个用链表表示的整数,每个节点包含一个数位。</p>

lcci/02.06.Palindrome Linked List/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.06. 回文链表](https://leetcode-cn.com/problems/palindrome-linked-list-lcci)
22

3+
[English Version](/lcci/02.06.Palindrome%20Linked%20List/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>编写一个函数,检查输入的链表是否是回文的。</p>

lcci/02.07.Intersection of Two Linked Lists/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.07. 链表相交](https://leetcode-cn.com/problems/intersection-of-two-linked-lists-lcci)
22

3+
[English Version](/lcci/02.07.Intersection%20of%20Two%20Linked%20Lists/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定两个(单向)链表,判定它们是否相交并返回交点。请注意相交的定义基于节点的引用,而不是基于节点的值。换句话说,如果一个链表的第k个节点与另一个链表的第j个节点是同一节点(引用完全相同),则这两个链表相交。</p><br><p><strong>示例 1:</strong><pre><strong>输入:</strong>intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3<br><strong>输出:</strong>Reference of the node with value = 8<br><strong>输入解释:</strong>相交节点的值为 8 (注意,如果两个列表相交则不能为 0)。从各自的表头开始算起,链表 A 为 [4,1,8,4,5],链表 B 为 [5,0,1,8,4,5]。在 A 中,相交节点前有 2 个节点;在 B 中,相交节点前有 3 个节点。</pre></p><br><p><strong>示例 2:</strong><pre><strong>输入:</strong>intersectVal = 2, listA = [0,9,1,2,4], listB = [3,2,4], skipA = 3, skipB = 1<br><strong>输出:</strong>Reference of the node with value = 2<br><strong>输入解释:</strong>相交节点的值为 2 (注意,如果两个列表相交则不能为 0)。从各自的表头开始算起,链表 A 为 [0,9,1,2,4],链表 B 为 [3,2,4]。在 A 中,相交节点前有 3 个节点;在 B 中,相交节点前有 1 个节点。</pre></p><br><p><strong>示例 3:</strong><pre><strong>输入:</strong>intersectVal = 0, listA = [2,6,4], listB = [1,5], skipA = 3, skipB = 2<br><strong>输出:</strong>null<br><strong>输入解释:</strong>从各自的表头开始算起,链表 A 为 [2,6,4],链表 B 为 [1,5]。由于这两个链表不相交,所以 intersectVal 必须为 0,而 skipA 和 skipB 可以是任意值。<br><strong>解释:</strong>这两个链表不相交,因此返回 null。</pre></p><br><p><strong>注意:</strong></p><ul><li>如果两个链表没有交点,返回 <code>null</code> 。</li><li>在返回结果后,两个链表仍须保持原有的结构。</li><li>可假定整个链表结构中没有循环。</li><li>程序尽量满足 O(<em>n</em>) 时间复杂度,且仅用 O(<em>1</em>) 内存。</li></ul>

lcci/02.08.Linked List Cycle/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 02.08. 环路检测](https://leetcode-cn.com/problems/linked-list-cycle-lcci)
22

3+
[English Version](/lcci/02.08.Linked%20List%20Cycle/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定一个有环链表,实现一个算法返回环路的开头节点。<br>有环链表的定义:在链表中某个节点的next元素指向在它前面出现过的节点,则表明该链表存在环路。</p><br><p><strong>示例 1:</strong><pre><strong>输入:</strong>head = [3,2,0,-4], pos = 1<br><strong>输出:</strong>tail connects to node index 1<br><strong>解释:</strong>链表中有一个环,其尾部连接到第二个节点。</pre></p><br><p><strong>示例 2:</strong><pre><strong>输入:</strong>head = [1,2], pos = 0<br><strong>输出:</strong>tail connects to node index 0<br><strong>解释:</strong>链表中有一个环,其尾部连接到第一个节点。</pre></p><br><p><strong>示例 3:</strong><pre><strong>输入:</strong>head = [1], pos = -1<br><strong>输出:</strong>no cycle<br><strong>解释:</strong>链表中没有环。</pre></p><br><p><strong>进阶:</strong><br>你是否可以不用额外空间解决此题?</p>

lcci/03.01.Three in One/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 03.01. 三合一](https://leetcode-cn.com/problems/three-in-one-lcci)
22

3+
[English Version](/lcci/03.01.Three%20in%20One/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>三合一。描述如何只用一个数组来实现三个栈。</p>

lcci/03.02.Min Stack/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 03.02. 栈的最小值](https://leetcode-cn.com/problems/min-stack-lcci)
22

3+
[English Version](/lcci/03.02.Min%20Stack/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>请设计一个栈,除了常规栈支持的pop与push函数以外,还支持min函数,该函数返回栈元素中的最小值。执行push、pop和min操作的时间复杂度必须为O(1)。</p><br><p><strong>示例:</strong><pre>MinStack minStack = new MinStack();<br>minStack.push(-2);<br>minStack.push(0);<br>minStack.push(-3);<br>minStack.getMin(); --> 返回 -3.<br>minStack.pop();<br>minStack.top(); --> 返回 0.<br>minStack.getMin(); --> 返回 -2.</pre></p>

lcci/03.03.Stack of Plates/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 03.03. 堆盘子](https://leetcode-cn.com/problems/stack-of-plates-lcci)
22

3+
[English Version](/lcci/03.03.Stack%20of%20Plates/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>堆盘子。设想有一堆盘子,堆太高可能会倒下来。因此,在现实生活中,盘子堆到一定高度时,我们就会另外堆一堆盘子。请实现数据结构<code>SetOfStacks</code>,模拟这种行为。<code>SetOfStacks</code>应该由多个栈组成,并且在前一个栈填满时新建一个栈。此外,<code>SetOfStacks.push()</code>和<code>SetOfStacks.pop()</code>应该与普通栈的操作方法相同(也就是说,pop()返回的值,应该跟只有一个栈时的情况一样)。 进阶:实现一个<code>popAt(int index)</code>方法,根据指定的子栈,执行pop操作。</p>

lcci/03.04.Implement Queue using Stacks/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 03.04. 化栈为队](https://leetcode-cn.com/problems/implement-queue-using-stacks-lcci)
22

3+
[English Version](/lcci/03.04.Implement%20Queue%20using%20Stacks/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>实现一个MyQueue类,该类用两个栈来实现一个队列。</p><br><p><strong>示例:</strong><pre>MyQueue queue = new MyQueue();<br><br>queue.push(1);<br>queue.push(2);<br>queue.peek(); // 返回 1<br>queue.pop(); // 返回 1<br>queue.empty(); // 返回 false</pre></p><br><p><strong>说明:</strong><br><ul><li>你只能使用标准的栈操作 -- 也就是只有 <code>push to top</code>, <code>peek/pop from top</code>, <code>size</code> 和 <code>is empty</code> 操作是合法的。</li><li>你所使用的语言也许不支持栈。你可以使用 list 或者 deque(双端队列)来模拟一个栈,只要是标准的栈操作即可。</li><li>假设所有操作都是有效的 (例如,一个空的队列不会调用 pop 或者 peek 操作)。</li></ul></p>

lcci/03.05.Sort of Stacks/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 03.05. 栈排序](https://leetcode-cn.com/problems/sort-of-stacks-lcci)
22

3+
[English Version](/lcci/03.05.Sort%20of%20Stacks/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>栈排序。 编写程序,对栈进行排序使最小元素位于栈顶。最多只能使用一个其他的临时栈存放数据,但不得将元素复制到别的数据结构(如数组)中。该栈支持如下操作:<code>push</code>、<code>pop</code>、<code>peek</code> 和 <code>isEmpty</code>。当栈为空时,<code>peek</code>&nbsp;返回 -1。</p>

lcci/03.06.Animal Shelter/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 03.06. 动物收容所](https://leetcode-cn.com/problems/animal-shelter-lcci)
22

3+
[English Version](/lcci/03.06.Animal%20Shelter/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>动物收容所。有家动物收容所只收容狗与猫,且严格遵守&ldquo;先进先出&rdquo;的原则。在收养该收容所的动物时,收养人只能收养所有动物中&ldquo;最老&rdquo;(由其进入收容所的时间长短而定)的动物,或者可以挑选猫或狗(同时必须收养此类动物中&ldquo;最老&rdquo;的)。换言之,收养人不能自由挑选想收养的对象。请创建适用于这个系统的数据结构,实现各种操作方法,比如<code>enqueue</code>、<code>dequeueAny</code>、<code>dequeueDog</code>和<code>dequeueCat</code>。允许使用Java内置的LinkedList数据结构。</p>

lcci/04.01.Route Between Nodes/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.01. 节点间通路](https://leetcode-cn.com/problems/route-between-nodes-lcci)
22

3+
[English Version](/lcci/04.01.Route%20Between%20Nodes/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>节点间通路。给定有向图,设计一个算法,找出两个节点之间是否存在一条路径。</p>

lcci/04.02.Minimum Height Tree/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.02. 最小高度树](https://leetcode-cn.com/problems/minimum-height-tree-lcci)
22

3+
[English Version](/lcci/04.02.Minimum%20Height%20Tree/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定一个有序整数数组,元素各不相同且按升序排列,编写一个算法,创建一棵高度最小的二叉搜索树。</p><strong>示例:</strong><pre>给定有序数组: [-10,-3,0,5,9],<br><br>一个可能的答案是:[0,-3,9,-10,null,5],它可以表示下面这个高度平衡二叉搜索树:<br><br> 0 <br> / &#92 <br> -3 9 <br> / / <br> -10 5 <br></pre>

lcci/04.03.List of Depth/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.03. 特定深度节点链表](https://leetcode-cn.com/problems/list-of-depth-lcci)
22

3+
[English Version](/lcci/04.03.List%20of%20Depth/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定一棵二叉树,设计一个算法,创建含有某一深度上所有节点的链表(比如,若一棵树的深度为 <code>D</code>,则会创建出 <code>D</code> 个链表)。返回一个包含所有深度的链表的数组。</p>

lcci/04.04.Check Balance/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.04. 检查平衡性](https://leetcode-cn.com/problems/check-balance-lcci)
22

3+
[English Version](/lcci/04.04.Check%20Balance/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>实现一个函数,检查二叉树是否平衡。在这个问题中,平衡树的定义如下:任意一个节点,其两棵子树的高度差不超过 1。</p><br><strong>示例 1:</strong><pre>给定二叉树 [3,9,20,null,null,15,7]<br> 3<br> / &#92<br> 9 20<br> / &#92<br> 15 7<br>返回 true 。</pre><strong>示例 2:</strong><br><pre>给定二叉树 [1,2,2,3,3,null,null,4,4]<br> 1<br> / &#92<br> 2 2<br> / &#92<br> 3 3<br> / &#92<br>4 4<br>返回 false 。</pre>

lcci/04.05.Legal Binary Search Tree/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.05. 合法二叉搜索树](https://leetcode-cn.com/problems/legal-binary-search-tree-lcci)
22

3+
[English Version](/lcci/04.05.Legal%20Binary%20Search%20Tree/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>实现一个函数,检查一棵二叉树是否为二叉搜索树。</p><strong>示例 1:</strong><pre><strong>输入:</strong><br> 2<br> / &#92<br> 1 3<br><strong>输出:</strong> true<br></pre><strong>示例 2:</strong><pre><strong>输入:</strong><br> 5<br> / &#92<br> 1 4<br>  / &#92<br>  3 6<br><strong>输出:</strong> false<br><strong>解释:</strong> 输入为: [5,1,4,null,null,3,6]。<br>  根节点的值为 5 ,但是其右子节点值为 4 。</pre>

lcci/04.06.Successor/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.06. 后继者](https://leetcode-cn.com/problems/successor-lcci)
22

3+
[English Version](/lcci/04.06.Successor/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>设计一个算法,找出二叉搜索树中指定节点的&ldquo;下一个&rdquo;节点(也即中序后继)。</p>

lcci/04.08.First Common Ancestor/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.08. 首个共同祖先](https://leetcode-cn.com/problems/first-common-ancestor-lcci)
22

3+
[English Version](/lcci/04.08.First%20Common%20Ancestor/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>设计并实现一个算法,找出二叉树中某两个节点的第一个共同祖先。不得将其他的节点存储在另外的数据结构中。注意:这不一定是二叉搜索树。</p><p>例如,给定如下二叉树: root = [3,5,1,6,2,0,8,null,null,7,4]</p><pre> 3<br> / &#92<br> 5 1<br> / &#92 / &#92<br>6 2 0 8<br> / &#92<br> 7 4<br></pre><strong>示例 1:</strong><pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1<br><strong>输入:</strong> 3<br><strong>解释:</strong> 节点 5 和节点 1 的最近公共祖先是节点 3。</pre><strong>示例 2:</strong><pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 4<br><strong>输出:</strong> 5<br><strong>解释:</strong> 节点 5 和节点 4 的最近公共祖先是节点 5。因为根据定义最近公共祖先节点可以为节点本身。</pre><strong>说明:</strong><pre>所有节点的值都是唯一的。<br>p、q 为不同节点且均存在于给定的二叉树中。</pre>

lcci/04.09.BST Sequences/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.09. 二叉搜索树序列](https://leetcode-cn.com/problems/bst-sequences-lcci)
22

3+
[English Version](/lcci/04.09.BST%20Sequences/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>从左向右遍历一个数组,通过不断将其中的元素插入树中可以逐步地生成一棵二叉搜索树。给定一个由不同节点组成的二叉树,输出所有可能生成此树的数组。</p>

lcci/04.10.Check SubTree/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.10. 检查子树](https://leetcode-cn.com/problems/check-subtree-lcci)
22

3+
[English Version](/lcci/04.10.Check%20SubTree/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>检查子树。你有两棵非常大的二叉树:T1,有几万个节点;T2,有几万个节点。设计一个算法,判断 T2 是否为 T1 的子树。</p>

lcci/04.12.Paths with Sum/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [面试题 04.12. 求和路径](https://leetcode-cn.com/problems/paths-with-sum-lcci)
22

3+
[English Version](/lcci/04.12.Paths%20with%20Sum/README_EN.md)
4+
35
## 题目描述
46
<!-- 这里写题目描述 -->
57
<p>给定一棵二叉树,其中每个节点都含有一个整数数值(该值或正或负)。设计一个算法,打印节点数值总和等于某个给定值的所有路径的数量。注意,路径不一定非得从二叉树的根节点或叶节点开始或结束,但是其方向必须向下(只能从父节点指向子节点方向)。</p>

0 commit comments

Comments
 (0)