Skip to content

Commit 03aa12e

Browse files
committed
chore: update lc problems
1 parent 6c1565a commit 03aa12e

File tree

21 files changed

+87
-83
lines changed

21 files changed

+87
-83
lines changed

solution/0200-0299/0264.Ugly Number II/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
<p>给你一个整数 <code>n</code> ,请你找出并返回第 <code>n</code> 个 <strong>丑数</strong> 。</p>
1010

11-
<p><strong>丑数 </strong>就是只包含质因数 <code>2</code>、<code>3</code> 和/或 <code>5</code> 的正整数。</p>
11+
<p><strong>丑数 </strong>就是质因子只包含&nbsp;<code>2</code>、<code>3</code> 和&nbsp;<code>5</code>&nbsp;的正整数。</p>
1212

13-
<p> </p>
13+
<p>&nbsp;</p>
1414

1515
<p><strong>示例 1:</strong></p>
1616

@@ -28,12 +28,12 @@
2828
<strong>解释:</strong>1 通常被视为丑数。
2929
</pre>
3030

31-
<p> </p>
31+
<p>&nbsp;</p>
3232

3333
<p><strong>提示:</strong></p>
3434

3535
<ul>
36-
<li><code>1 <= n <= 1690</code></li>
36+
<li><code>1 &lt;= n &lt;= 1690</code></li>
3737
</ul>
3838

3939
## 解法

solution/0200-0299/0275.H-Index II/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<p>给你一个整数数组 <code>citations</code> ,其中 <code>citations[i]</code> 表示研究者的第 <code>i</code> 篇论文被引用的次数,<code>citations</code> 已经按照&nbsp;<strong>升序排列&nbsp;</strong>。计算并返回该研究者的 h<strong><em>&nbsp;</em></strong>指数。</p>
1010

11-
<p><a href="https://baike.baidu.com/item/h-index/3991452?fr=aladdin" target="_blank">h 指数的定义</a>:h 代表“高引用次数”(high citations),一名科研人员的 <code>h</code> 指数是指他(她)的 (<code>n</code> 篇论文中)<strong>总共</strong>有 <code>h</code> 篇论文分别被引用了<strong>至少</strong> <code>h</code> 次。</p>
11+
<p><a href="https://baike.baidu.com/item/h-index/3991452?fr=aladdin" target="_blank">h 指数的定义</a>:h 代表“高引用次数”(high citations),一名科研人员的 <code>h</code> 指数是指他(她)的 (<code>n</code> 篇论文中)<strong>至少&nbsp;</strong>有 <code>h</code> 篇论文分别被引用了<strong>至少</strong> <code>h</code> 次。</p>
1212

1313
<p>请你设计并实现对数时间复杂度的算法解决此问题。</p>
1414

@@ -17,16 +17,16 @@
1717
<p><strong class="example">示例 1:</strong></p>
1818

1919
<pre>
20-
<strong>输入<code>:</code></strong><code>citations = [0,1,3,5,6]</code>
21-
<strong>输出:</strong>3
22-
<strong>解释:</strong>给定数组表示研究者总共有 <code>5</code> 篇论文,每篇论文相应的被引用了 0<code>, 1, 3, 5, 6</code> 次。
23-
&nbsp; 由于研究者有 <code>3 </code>篇论文每篇<strong> 至少 </strong>被引用了 <code>3</code> 次,其余两篇论文每篇被引用<strong> 不多于</strong> <code>3</code> 次,所以她的<em> h </em>指数是 <code>3</code> 。</pre>
20+
<strong>输入</strong><code>citations = [0,1,3,5,6]</code>
21+
<strong>输出:</strong><code>3</code>
22+
<strong>解释:</strong>给定数组表示研究者总共有 <code>5</code> 篇论文,每篇论文相应的被引用了 <code>0, 1, 3, 5, 6</code> 次。
23+
&nbsp; 由于研究者有<code>3</code>篇论文每篇<strong> 至少 </strong>被引用了 <code>3</code> 次,其余两篇论文每篇被引用<strong> 不多于</strong> <code>3</code> 次,所以她的<em> h </em>指数是 <code>3</code> 。</pre>
2424

2525
<p><strong class="example">示例 2:</strong></p>
2626

2727
<pre>
28-
<strong>输入:</strong>citations = [1,2,100]
29-
<strong>输出:</strong>2
28+
<strong>输入:</strong><code>citations = [1,2,100]</code>
29+
<strong>输出:</strong><code>2</code>
3030
</pre>
3131

3232
<p>&nbsp;</p>

solution/0400-0499/0484.Find Permutation/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p>由范围 <code>[1,n]</code> 内所有整数组成的 <code>n</code> 个整数的排列&nbsp;<code>perm</code>&nbsp;可以表示为长度为 <code>n - 1</code> 的字符串 <code>s</code> ,其中:</p>
1010

1111
<ul>
12-
<li>如果 <code>perm[i] &lt; perm[i + 1]</code> ,那么 <code>s[i] == ' i '</code></li>
12+
<li>如果 <code>perm[i] &lt; perm[i + 1]</code> ,那么 <code>s[i] == 'I'</code></li>
1313
<li>如果&nbsp;<code>perm[i] &gt; perm[i + 1]</code>&nbsp;,那么 <code>s[i] == 'D'</code>&nbsp;。</li>
1414
</ul>
1515

solution/0600-0699/0603.Consecutive Available Seats/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
| seat_id | int |
1616
| free | bool |
1717
+-------------+------+
18-
在 SQL 中,Seat_id 是该表的自动递增主键列。
18+
Seat_id 是该表的自动递增主键列。
19+
在 PostgreSQL 中,<code>free</code> 存储为整数。请使用 <code>::boolean</code> 将其转换为布尔格式。
1920
该表的每一行表示第 i 个座位是否空闲。1 表示空闲,0 表示被占用。</pre>
2021

2122
<p>&nbsp;</p>

solution/0600-0699/0603.Consecutive Available Seats/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| seat_id | int |
1414
| free | bool |
1515
+-------------+------+
16-
In SQL, seat_id is an auto-increment primary key column for this table.
16+
seat_id is an auto-increment column for this table.
1717
Each row of this table indicates whether the i<sup>th</sup> seat is free or not. 1 means free while 0 means occupied.
1818
</pre>
1919

solution/1100-1199/1159.Market Analysis II/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ item_id 是该表的主键(具有唯一值的列)。
5151

5252
<p>&nbsp;</p>
5353

54-
<p>编写一个解决方案,查找每个用户的加入日期和作为买家在 <code>2019</code> 年下的订单数。</p>
54+
<p>编写一个解决方案,查找每个用户的加入日期和他们作为买家在 <code>2019</code> 年下的订单数。</p>
5555

5656
<p>以 <strong>任意顺序</strong> 返回结果表。</p>
5757

solution/1200-1299/1220.Count Vowels Permutation/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
<li>Each vowel&nbsp;<code>&#39;e&#39;</code> may only be followed by an <code>&#39;a&#39;</code>&nbsp;or an <code>&#39;i&#39;</code>.</li>
1313
<li>Each vowel&nbsp;<code>&#39;i&#39;</code> <strong>may not</strong> be followed by another <code>&#39;i&#39;</code>.</li>
1414
<li>Each vowel&nbsp;<code>&#39;o&#39;</code> may only be followed by an <code>&#39;i&#39;</code> or a&nbsp;<code>&#39;u&#39;</code>.</li>
15-
<li>Each vowel&nbsp;<code>&#39;u&#39;</code> may only be followed by an <code>&#39;a&#39;.</code></li>
15+
<li>Each vowel&nbsp;<code>&#39;u&#39;</code> may only be followed by an <code>&#39;a&#39;</code>.</li>
1616
</ul>
1717

18-
<p>Since the answer&nbsp;may be too large,&nbsp;return it modulo <code>10^9 + 7.</code></p>
18+
<p>Since the answer&nbsp;may be too large,&nbsp;return it modulo&nbsp;<code>10^9 + 7</code>.</p>
1919

2020
<p>&nbsp;</p>
2121
<p><strong class="example">Example 1:</strong></p>

solution/1900-1999/1965.Employees With Missing Information/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
| name | varchar |
1717
+-------------+---------+
1818
employee_id 是该表中具有唯一值的列。
19-
每一行表示雇员的id 和他的姓名。
19+
每一行表示雇员的 id 和他的姓名。
2020
</pre>
2121

2222
<p>表: <code>Salaries</code></p>
@@ -28,8 +28,8 @@ employee_id 是该表中具有唯一值的列。
2828
| employee_id | int |
2929
| salary | int |
3030
+-------------+---------+
31-
employee_id is 是该表中具有唯一值的列。
32-
每一行表示雇员的id 和他的薪水。
31+
employee_id 是该表中具有唯一值的列。
32+
每一行表示雇员的 id 和他的薪水。
3333
</pre>
3434

3535
<p>&nbsp;</p>
@@ -38,10 +38,10 @@ employee_id is 是该表中具有唯一值的列。
3838

3939
<ul>
4040
<li>雇员的 <strong>姓名</strong> 丢失了,或者</li>
41-
<li>雇员的 <strong>薪水信息</strong> 丢失了,或者</li>
41+
<li>雇员的 <strong>薪水信息</strong> 丢失了</li>
4242
</ul>
4343

44-
<p>返回这些雇员的id &nbsp;<code>employee_id</code>&nbsp;&nbsp;<strong>从小到大排序&nbsp;</strong>。</p>
44+
<p>返回这些雇员的 id &nbsp;<code>employee_id</code>&nbsp;&nbsp;<strong>从小到大排序&nbsp;</strong>。</p>
4545

4646
<p>查询结果格式如下面的例子所示。</p>
4747

@@ -75,9 +75,9 @@ Salaries table:
7575
| 2 |
7676
+-------------+
7777
<strong>解释:</strong>
78-
雇员1,2,4,5 都工作在这个公司
79-
1号雇员的姓名丢失了
80-
2号雇员的薪水信息丢失了。</pre>
78+
雇员 1,2,4,5 都在这个公司工作
79+
1 号雇员的姓名丢失了
80+
2 号雇员的薪水信息丢失了。</pre>
8181

8282
## 解法
8383

solution/2100-2199/2127.Maximum Employees to Be Invited to a Meeting/README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
<p><strong>示例 1:</strong></p>
1818

19-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/images/ex1.png" style="width: 236px; height: 195px;"></p>
19+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/images/ex1.png" style="width: 236px; height: 195px;" /></p>
2020

21-
<pre><b>输入:</b>favorite = [2,2,1,2]
21+
<pre>
22+
<b>输入:</b>favorite = [2,2,1,2]
2223
<b>输出:</b>3
2324
<strong>解释:</strong>
2425
上图展示了公司邀请员工 0,1 和 2 参加会议以及他们在圆桌上的座位。
@@ -29,7 +30,8 @@
2930

3031
<p><strong>示例 2:</strong></p>
3132

32-
<pre><b>输入:</b>favorite = [1,2,0]
33+
<pre>
34+
<b>输入:</b>favorite = [1,2,0]
3335
<b>输出:</b>3
3436
<b>解释:</b>
3537
每个员工都至少是另一个员工喜欢的员工。所以公司邀请他们所有人参加会议的前提是所有人都参加了会议。
@@ -42,13 +44,14 @@
4244

4345
<p><strong>示例 3:</strong></p>
4446

45-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/images/ex2.png" style="width: 219px; height: 220px;"></p>
47+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2100-2199/2127.Maximum%20Employees%20to%20Be%20Invited%20to%20a%20Meeting/images/ex2.png" style="width: 219px; height: 220px;" /></p>
4648

47-
<pre><b>输入:</b>favorite = [3,0,1,4,1]
49+
<pre>
50+
<b>输入:</b>favorite = [3,0,1,4,1]
4851
<b>输出:</b>4
4952
<b>解释:</b>
5053
上图展示了公司可以邀请员工 0,1,3 和 4 参加会议以及他们在圆桌上的座位。
51-
员工 2 无法参加,因为他喜欢的员工 0 旁边的座位已经被占领了。
54+
员工 2 无法参加,因为他喜欢的员工 1 旁边的座位已经被占领了。
5255
所以公司只能不邀请员工 2 。
5356
参加会议的最多员工数目为 4 。
5457
</pre>

solution/2100-2199/2171.Removing Minimum Number of Magic Beans/README_EN.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
<p><strong class="example">Example 1:</strong></p>
1515

1616
<pre>
17-
<strong>Input:</strong> beans = [4,<u><strong>1</strong></u>,6,5]
17+
<strong>Input:</strong> beans = [4,1,6,5]
1818
<strong>Output:</strong> 4
1919
<strong>Explanation:</strong>
2020
- We remove 1 bean from the bag with only 1 bean.
21-
This results in the remaining bags: [4,<b><u>0</u></b>,6,5]
21+
This results in the remaining bags: [4,<strong><u>0</u></strong>,6,5]
2222
- Then we remove 2 beans from the bag with 6 beans.
2323
This results in the remaining bags: [4,0,<strong><u>4</u></strong>,5]
2424
- Then we remove 1 bean from the bag with 5 beans.
25-
This results in the remaining bags: [4,0,4,<b><u>4</u></b>]
25+
This results in the remaining bags: [4,0,4,<strong><u>4</u></strong>]
2626
We removed a total of 1 + 2 + 1 = 4 beans to make the remaining non-empty bags have an equal number of beans.
2727
There are no other solutions that remove 4 beans or fewer.
2828
</pre>
2929

3030
<p><strong class="example">Example 2:</strong></p>
3131

3232
<pre>
33-
<strong>Input:</strong> beans = [<strong><u>2</u></strong>,10,<u><strong>3</strong></u>,<strong><u>2</u></strong>]
33+
<strong>Input:</strong> beans = [2,10,3,2]
3434
<strong>Output:</strong> 7
3535
<strong>Explanation:</strong>
3636
- We remove 2 beans from one of the bags with 2 beans.

solution/2500-2599/2561.Rearranging Fruits/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>你有两个果篮,每个果篮中有 <code>n</code> 个水果。给你两个下标从 <strong>0</strong> 开始的整数数组 <code>basket1</code> 和 <code>basket2</code> ,用以表示两个果篮中每个水果的成本。</p>
10-
11-
<p>你希望两个果篮相等。为此,可以根据需要多次执行下述操作:</p>
9+
<p>你有两个果篮,每个果篮中有 <code>n</code> 个水果。给你两个下标从 <strong>0</strong> 开始的整数数组 <code>basket1</code> 和 <code>basket2</code> ,用以表示两个果篮中每个水果的交换成本。为了让两个果篮中水果的数量相等。为此,可以根据需要多次执行下述操作:</p>
1210

1311
<ul>
1412
<li>选中两个下标 <code>i</code> 和 <code>j</code> ,并交换 <code>basket1</code> 中的第 <code>i</code> 个水果和 <code>basket2</code> 中的第 <code>j</code> 个水果。</li>

solution/2500-2599/2561.Rearranging Fruits/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<p><strong>Constraints:</strong></p>
3737

3838
<ul>
39-
<li><code>basket1.length == </code>basket2<code>.length</code></li>
39+
<li><code>basket1.length == basket2.length</code></li>
4040
<li><code>1 &lt;= basket1.length &lt;= 10<sup>5</sup></code></li>
4141
<li><code>1 &lt;= basket1[i],basket2[i]&nbsp;&lt;= 10<sup>9</sup></code></li>
4242
</ul>

solution/2700-2799/2764.is Array a Preorder of Some ‌Binary Tree/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<b>输入:</b>nodes = [[0,-1],[1,0],[2,0],[3,2],[4,2]]
2323
<b>输出:</b>true
2424
<b>解释:</b>给定的 nodes 数组可以构成下面图片中的树。
25-
我们可以验证这是树的前序遍历,首先访问节点 0,然后对右子节点进行前序遍历,即 [1] ,然后对左子节点进行前序遍历,即 [2,3,4] 。
25+
我们可以验证这是树的前序遍历,首先访问节点 0,然后对左子节点进行前序遍历,即 [1] ,然后对右子节点进行前序遍历,即 [2,3,4] 。
2626
</pre>
2727

2828
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2700-2799/2764.is%20Array%20a%20Preorder%20of%20Some%20%E2%80%8CBinary%20Tree/images/1.png" style="padding: 10px; background: #fff; border-radius: .5rem; width: 250px; height: 251px;" /></p>
@@ -33,7 +33,7 @@
3333
<b>输入:</b>nodes = [[0,-1],[1,0],[2,0],[3,1],[4,1]]
3434
<b>输出:</b>false
3535
<b>解释:</b>给定的 nodes 数组可以构成下面图片中的树。
36-
对于前序遍历,首先访问节点 0,然后对右子节点进行前序遍历,即 [1,3,4],但是我们可以看到在给定的顺序中,2 位于 1 和 3 之间,因此它不是树的前序遍历。
36+
对于前序遍历,首先访问节点 0,然后对左子节点进行前序遍历,即 [1,3,4],但是我们可以看到在给定的顺序中,2 位于 1 和 3 之间,因此它不是树的前序遍历。
3737
</pre>
3838

3939
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2700-2799/2764.is%20Array%20a%20Preorder%20of%20Some%20%E2%80%8CBinary%20Tree/images/2.png" style="padding: 10px; background: #fff; border-radius: .5rem; width: 250px; height: 251px;" /></p>

solution/2700-2799/2778.Sum of Squares of Special Elements/README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@
1616

1717
<p><strong>示例 1:</strong></p>
1818

19-
<pre><strong>输入:</strong>nums = [1,2,3,4]
19+
<pre>
20+
<strong>输入:</strong>nums = [1,2,3,4]
2021
<strong>输出:</strong>21
21-
<strong>解释:</strong>nums 中共有 3 个特殊元素:nums[1] ,因为 4 被 1 整除;nums[2] ,因为 4 被 2 整除;以及 nums[4] ,因为 4 被 4 整除。
22-
因此,nums 中所有元素的平方和等于 nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21 。
22+
<strong>解释:</strong>nums 中共有 3 个特殊元素:nums[1],因为 4 被 1 整除;nums[2],因为 4 被 2 整除;以及 nums[4],因为 4 被 4 整除。
23+
因此,nums 中所有特殊元素的平方和等于 nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21 。
2324
</pre>
2425

2526
<p><strong>示例 2:</strong></p>
2627

27-
<pre><strong>输入:</strong>nums = [2,7,1,19,18,3]
28+
<pre>
29+
<strong>输入:</strong>nums = [2,7,1,19,18,3]
2830
<strong>输出:</strong>63
29-
<strong>解释:</strong>nums 中共有 4 个特殊元素:nums[1] ,因为 6 被 1 整除;nums[2] ,因为 6 被 2 整除;nums[3] ,因为 6 被 3 整除;以及 nums[6] ,因为 6 被 6 整除。
30-
因此,nums 中所有元素的平方和等于 nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63 。 </pre>
31+
<strong>解释:</strong>nums 中共有 4 个特殊元素:nums[1],因为 6 被 1 整除;nums[2] ,因为 6 被 2 整除;nums[3],因为 6 被 3 整除;以及 nums[6],因为 6 被 6 整除。
32+
因此,nums 中所有特殊元素的平方和等于 nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63 。 </pre>
3133

3234
<p>&nbsp;</p>
3335

solution/2900-2999/2919.Minimum Increment Operations to Make Array Beautiful/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<p>你可以执行下述 <strong>递增</strong> 运算 <strong>任意</strong> 次(可以是 <strong>0</strong> 次):</p>
1212

1313
<ul>
14-
<li>从范围&nbsp;<code>[0, n - 1]</code> 中选则一个下标 <code>i</code> ,并将 <code>nums[i]</code> 的值加 <code>1</code> 。</li>
14+
<li>从范围&nbsp;<code>[0, n - 1]</code> 中选择一个下标 <code>i</code> ,并将 <code>nums[i]</code> 的值加 <code>1</code> 。</li>
1515
</ul>
1616

1717
<p>如果数组中任何长度 <strong>大于或等于 3</strong> 的子数组,其 <strong>最大</strong> 元素都大于或等于 <code>k</code> ,则认为数组是一个 <strong>美丽数组</strong> 。</p>

solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>节点 <code>0</code> 处现有一棵由 <code>n</code> 个节点组成的无向树,节点编号从 <code>0</code> 到 <code>n - 1</code> 。给你一个长度为 <code>n - 1</code> 的二维 <strong>整数</strong> 数组 <code>edges</code> ,其中 <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> 表示在树上的节点 <code>a<sub>i</sub></code> 和 <code>b<sub>i</sub></code> 之间存在一条边。另给你一个下标从 <strong>0</strong> 开始、长度为 <code>n</code> 的数组 <code>coins</code> 和一个整数 <code>k</code> ,其中 <code>coins[i]</code> 表示节点 <code>i</code> 处的金币数量。</p>
9+
<p>有一棵由 <code>n</code> 个节点组成的无向树,以&nbsp;<code>0</code>&nbsp; 为根节点,节点编号从 <code>0</code> 到 <code>n - 1</code> 。给你一个长度为 <code>n - 1</code> 的二维 <strong>整数</strong> 数组 <code>edges</code> ,其中 <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> 表示在树上的节点 <code>a<sub>i</sub></code> 和 <code>b<sub>i</sub></code> 之间存在一条边。另给你一个下标从 <strong>0</strong> 开始、长度为 <code>n</code> 的数组 <code>coins</code> 和一个整数 <code>k</code> ,其中 <code>coins[i]</code> 表示节点 <code>i</code> 处的金币数量。</p>
1010

1111
<p>从根节点开始,你必须收集所有金币。要想收集节点上的金币,必须先收集该节点的祖先节点上的金币。</p>
1212

@@ -22,7 +22,7 @@
2222
<p>&nbsp;</p>
2323

2424
<p><strong class="example">示例 1:</strong></p>
25-
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/ex1-copy.png" style="width: 60px; height: 316px; padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem;" />
25+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/images/ex1-copy.png" style="width: 60px; height: 316px; padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem;" />
2626
<pre>
2727
<strong>输入:</strong>edges = [[0,1],[1,2],[2,3]], coins = [10,10,3,3], k = 5
2828
<strong>输出:</strong>11
@@ -35,7 +35,7 @@
3535
</pre>
3636

3737
<p><strong class="example">示例 2:</strong></p>
38-
<strong class="example"> <img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/ex2.png" style="width: 140px; height: 147px; padding: 10px; background: #fff; border-radius: .5rem;" /></strong>
38+
<strong class="example"> <img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/images/ex2.png" style="width: 140px; height: 147px; padding: 10px; background: #fff; border-radius: .5rem;" /></strong>
3939

4040
<pre>
4141
<strong>输入:</strong>edges = [[0,1],[0,2]], coins = [8,4,4], k = 0

0 commit comments

Comments
 (0)