Skip to content

Commit 9015f7c

Browse files
authored
chore: update lc problems (doocs#1950)
1 parent b13d51e commit 9015f7c

File tree

13 files changed

+107
-99
lines changed

13 files changed

+107
-99
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<p><strong>示例 1:</strong></p>
1818

1919
<pre>
20-
<b>输入:</b>beans = [4,<u><strong>1</strong></u>,6,5]
20+
<b>输入:</b>beans = [4,1,6,5]
2121
<b>输出:</b>4
2222
<b>解释:</b>
2323
- 我们从有 1 个魔法豆的袋子中拿出 1 颗魔法豆。
@@ -33,7 +33,7 @@
3333
<p><strong>示例 2:</strong></p>
3434

3535
<pre>
36-
<b>输入:</b>beans = [<u><strong>2</strong></u>,10,<u><strong>3</strong></u>,<u><strong>2</strong></u>]
36+
<b>输入:</b>beans = [2,10,3,2]
3737
<b>输出:</b>7
3838
<strong>解释:</strong>
3939
- 我们从有 2 个魔法豆的其中一个袋子中拿出 2 个魔法豆。

solution/2900-2999/2921.Maximum Profitable Triplets With Increasing Prices II/README.md

+25-23
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,54 @@
1-
# [2921. Maximum Profitable Triplets With Increasing Prices II](https://leetcode.cn/problems/maximum-profitable-triplets-with-increasing-prices-ii)
1+
# [2921. 具有递增价格的最大利润三元组 II](https://leetcode.cn/problems/maximum-profitable-triplets-with-increasing-prices-ii)
22

33
[English Version](/solution/2900-2999/2921.Maximum%20Profitable%20Triplets%20With%20Increasing%20Prices%20II/README_EN.md)
44

55
## 题目描述
66

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

9-
<p>Given the <strong>0-indexed</strong> arrays <code>prices</code> and <code>profits</code> of length <code>n</code>. There are <code>n</code> items in an store where the <code>i<sup>th</sup></code> item has a price of <code>prices[i]</code> and a profit of <code>profits[i]</code>.</p>
9+
<p>给定长度为 <code>n</code>&nbsp; 的数组&nbsp;<code>prices</code>&nbsp;&nbsp;<code>profits</code>&nbsp;(<strong>下标从 0 开始</strong>)。一个商店有&nbsp;<code>n</code>&nbsp;个商品,第&nbsp;<code>i</code>&nbsp;个商品的价格为&nbsp;<code>prices[i]</code>,利润为&nbsp;<code>profits[i]</code></p>
1010

11-
<p>We have to pick three items with the following condition:</p>
11+
<p>需要选择三个商品,满足以下条件:</p>
1212

1313
<ul>
14-
<li><code>prices[i] &lt; prices[j] &lt; prices[k]</code> where <code>i &lt; j &lt; k</code>.</li>
14+
<li><code>prices[i] &lt; prices[j] &lt; prices[k]</code>,其中&nbsp;<code>i &lt; j &lt; k</code></li>
1515
</ul>
1616

17-
<p>If we pick items with indices <code>i</code>, <code>j</code> and <code>k</code> satisfying the above condition, the profit would be <code>profits[i] + profits[j] + profits[k]</code>.</p>
17+
<p>如果选择的商品&nbsp;<code>i</code>, <code>j</code>&nbsp;&nbsp;<code>k</code>&nbsp;满足以下条件,那么利润将等于&nbsp;<code>profits[i] + profits[j] + profits[k]</code></p>
1818

19-
<p>Return<em> the <strong>maximum profit</strong> we can get, and </em><code>-1</code><em> if it&#39;s not possible to pick three items with the given condition.</em></p>
19+
<p>返回能够获得的<em>&nbsp;<strong>最大利润</strong>,如果不可能满足给定条件,</em>返回<em>&nbsp;</em><code>-1</code><em></em></p>
2020

2121
<p>&nbsp;</p>
22-
<p><strong class="example">Example 1:</strong></p>
22+
23+
<p><strong>示例 1:</strong></p>
2324

2425
<pre>
25-
<strong>Input:</strong> prices = [10,2,3,4], profits = [100,2,7,10]
26-
<strong>Output:</strong> 19
27-
<strong>Explanation:</strong> We can&#39;t pick the item with index i=0 since there are no indices j and k such that the condition holds.
28-
So the only triplet we can pick, are the items with indices 1, 2 and 3 and it&#39;s a valid pick since prices[1] &lt; prices[2] &lt; prices[3].
29-
The answer would be sum of their profits which is 2 + 7 + 10 = 19.</pre>
26+
<b>输入:</b>prices = [10,2,3,4], profits = [100,2,7,10]
27+
<b>输出:</b>19
28+
<b>解释:</b>不能选择下标 i=0 的商品,因为没有下标 j 和 k 的商品满足条件。
29+
只能选择下标为 1、2、3 的三个商品,这是有效的选择,因为 prices[1] &lt; prices[2] &lt; prices[3]
30+
答案是它们的利润之和,即 2 + 7 + 10 = 19</pre>
3031

31-
<p><strong class="example">Example 2:</strong></p>
32+
<p><strong>示例 2:</strong></p>
3233

3334
<pre>
34-
<strong>Input:</strong> prices = [1,2,3,4,5], profits = [1,5,3,4,6]
35-
<strong>Output:</strong> 15
36-
<strong>Explanation:</strong> We can select any triplet of items since for each triplet of indices i, j and k such that i &lt; j &lt; k, the condition holds.
37-
Therefore the maximum profit we can get would be the 3 most profitable items which are indices 1, 3 and 4.
38-
The answer would be sum of their profits which is 5 + 4 + 6 = 15.</pre>
35+
<b>输入:</b>prices = [1,2,3,4,5], profits = [1,5,3,4,6]
36+
<b>输出:</b>15
37+
<b>解释:</b>可以选择任意三个商品,因为对于每组满足下标为 i &lt; j &lt; k 的三个商品,条件都成立。
38+
因此,能得到的最大利润就是利润和最大的三个商品,即下标为 1,3 和 4 的商品。
39+
答案就是它们的利润之和,即 5 + 4 + 6 = 15</pre>
3940

40-
<p><strong class="example">Example 3:</strong></p>
41+
<p><strong>示例 3:</strong></p>
4142

4243
<pre>
43-
<strong>Input:</strong> prices = [4,3,2,1], profits = [33,20,19,87]
44-
<strong>Output:</strong> -1
45-
<strong>Explanation:</strong> We can&#39;t select any triplet of indices such that the condition holds, so we return -1.
44+
<b>输入:</b>prices = [4,3,2,1], profits = [33,20,19,87]
45+
<b>输出:</b>-1
46+
<b>解释:</b>找不到任何可以满足条件的三个商品,所以返回 -1.
4647
</pre>
4748

4849
<p>&nbsp;</p>
49-
<p><strong>Constraints:</strong></p>
50+
51+
<p><b>提示:</b></p>
5052

5153
<ul>
5254
<li><code>3 &lt;= prices.length == profits.length &lt;= 50000</code></li>

solution/2900-2999/2922.Market Analysis III/README.md

+21-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [2922. Market Analysis III](https://leetcode.cn/problems/market-analysis-iii)
1+
# [2922. 市场分析 III](https://leetcode.cn/problems/market-analysis-iii)
22

33
[English Version](/solution/2900-2999/2922.Market%20Analysis%20III/README_EN.md)
44

@@ -16,8 +16,8 @@
1616
| join_date | date |
1717
| favorite_brand | varchar |
1818
+----------------+---------+
19-
seller_id is the primary key for this table.
20-
This table contains seller id, join date, and favorite brand of sellers.
19+
seller_id 是该表的主键。
20+
该表包含销售者的 ID, 加入日期以及最喜欢的品牌。
2121
</pre>
2222

2323
<p>Table: <code>Items</code></p>
@@ -29,8 +29,8 @@ This table contains seller id, join date, and favorite brand of sellers.
2929
| item_id | int |
3030
| item_brand | varchar |
3131
+---------------+---------+
32-
item_id is the primary key for this table.
33-
This table contains item id and item brand.</pre>
32+
item_id 是该表的主键。
33+
该表包含商品 ID 和商品品牌。</pre>
3434

3535
<p>Table: <code>Orders</code></p>
3636

@@ -43,22 +43,23 @@ This table contains item id and item brand.</pre>
4343
| item_id | int |
4444
| seller_id | int |
4545
+---------------+---------+
46-
order_id is the primary key for this table.
47-
item_id is a foreign key to the Items table.
48-
seller_id is a foreign key to the Users table.
49-
This table contains order id, order date, item id and seller id.</pre>
46+
order_id 是该表的主键。
47+
item_id 是指向 Items 表的外键。
48+
seller_id 是指向 Users 表的外键。
49+
该表包含订单 ID、下单日期、商品 ID 和卖家 ID。</pre>
5050

51-
<p>Write a solution to find the <strong>top seller</strong> who has sold the highest number of<strong> unique</strong> items with a <strong>different</strong> brand than their favorite brand. If there are multiple sellers with the same highest count, return all of them.</p>
51+
<p>编写一个解决方案,找到销售最多与其最喜欢的品牌 <strong>不同</strong> <strong>独特</strong> 商品的&nbsp;<strong>顶级卖家</strong>。如果有多个卖家销售同样数量的商品,则返回所有这些卖家。&nbsp;</p>
5252

53-
<p>Return <em>the result table ordered by</em> <code>seller_id</code> <em>in <strong>ascending</strong> order.</em></p>
53+
<p>返回按&nbsp;<code>seller_id</code><em>&nbsp;<strong>升序排序</strong>&nbsp;的结果表。</em></p>
5454

55-
<p>The result format is in the following example.</p>
55+
<p>结果格式如下示例所示。</p>
5656

5757
<p>&nbsp;</p>
58-
<p><strong class="example">Example 1:</strong></p>
58+
59+
<p><b>示例 1:</b></p>
5960

6061
<pre>
61-
<strong>Input:</strong>
62+
<b>输入:</b>
6263
Users table:
6364
+-----------+------------+----------------+
6465
| seller_id | join_date | favorite_brand |
@@ -86,17 +87,18 @@ Items table:
8687
| 3 | LG |
8788
| 4 | HP |
8889
+---------+------------+
89-
<strong>Output:</strong>
90+
<b>输出:</b>
9091
+-----------+-----------+
9192
| seller_id | num_items |
9293
+-----------+-----------+
9394
| 2 | 1 |
9495
| 3 | 1 |
9596
+-----------+-----------+
96-
<strong>Explanation:</strong>
97-
- The user with seller_id 2 has sold three items, but only two of them are not marked as a favorite. We will include a unique count of 1 because both of these items are identical.
98-
- The user with seller_id 3 has sold two items, but only one of them is not marked as a favorite. We will include just that non-favorite item in our count.
99-
Since seller_ids 2 and 3 have the same count of one item each, they both will be displayed in the output.</pre>
97+
<b>解释:</b>
98+
- 卖家 ID 为 2 的用户销售了三件商品,但只有两件不被标记为最喜欢的商品。我们将只列入独特计数为 1,因为这两件商品都是相同的。
99+
- 卖家 ID 为 3 的用户销售了两件商品,但只有一件不被标记为最喜欢的商品。我们将只包括那个不被标记为最喜欢的商品列入计数中。
100+
因为卖家 ID 为 2 和 3 的卖家都有一件商品列入计数,所以他们都将显示在输出中。
101+
</pre>
100102

101103
## 解法
102104

solution/2900-2999/2923.Find Champion I/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ grid[1][2] == 1 表示 1 队比 2 队强。
4444
<li><code>n == grid.length</code></li>
4545
<li><code>n == grid[i].length</code></li>
4646
<li><code>2 &lt;= n &lt;= 100</code></li>
47-
<li><code>grid[i][j]</code> 的值为 <code>0</code> 或 <code>1</code></li>
47+
<li><code>grid[i][j]</code> 的值为 <code>0</code> 或 <code>1</code><meta charset="UTF-8" /></li>
48+
<li>对于所有&nbsp;<code>i</code>,<code> grid[i][i]</code>&nbsp;等于&nbsp;<code>0.</code></li>
4849
<li>对于满足&nbsp;<code>i != j</code> 的所有 <code>i, j</code> ,<code>grid[i][j] != grid[j][i]</code> 均成立</li>
49-
<li>生成的输出满足:如果 <code>a</code> 队比 <code>b</code> 队强,<code>b</code> 队比 <code>c</code> 队强,那么 <code>a</code> 队比 <code>c</code> 队强</li>
50+
<li>生成的输入满足:如果 <code>a</code> 队比 <code>b</code> 队强,<code>b</code> 队比 <code>c</code> 队强,那么 <code>a</code> 队比 <code>c</code> 队强</li>
5051
</ul>
5152

5253
## 解法

solution/2900-2999/2923.Find Champion I/README_EN.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ So team 1 will be the champion.
4141
<li><code>n == grid[i].length</code></li>
4242
<li><code>2 &lt;= n &lt;= 100</code></li>
4343
<li><code>grid[i][j]</code> is either <code>0</code> or <code>1</code>.</li>
44+
<li>For all <code>i grid[i][i]</code> is <code>0.</code></li>
4445
<li>For all <code>i, j</code> that <code>i != j</code>, <code>grid[i][j] != grid[j][i]</code>.</li>
4546
<li>The input is generated such that if team <code>a</code> is stronger than team <code>b</code> and team <code>b</code> is stronger than team <code>c</code>, then team <code>a</code> is stronger than team <code>c</code>.</li>
4647
</ul>

solution/2900-2999/2927.Distribute Candies Among Children III/README.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
# [2927. Distribute Candies Among Children III](https://leetcode.cn/problems/distribute-candies-among-children-iii)
1+
# [2927. 将糖果分发给孩子 III](https://leetcode.cn/problems/distribute-candies-among-children-iii)
22

33
[English Version](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README_EN.md)
44

55
## 题目描述
66

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

9-
<p>You are given two positive integers <code>n</code> and <code>limit</code>.</p>
9+
<p>你被给定两个正整数 <code>n</code> <code>limit</code></p>
1010

11-
<p>Return <em>the <strong>total number</strong> of ways to distribute </em><code>n</code> <em>candies among </em><code>3</code><em> children such that no child gets more than </em><code>limit</code><em> candies.</em></p>
11+
<p>返回 <em>在每个孩子得到不超过&nbsp;</em><code>limit</code><em> 个糖果的情况下,将</em> <code>n</code> <em>个糖果分发给</em>&nbsp;<code>3</code> <em>个孩子的&nbsp;<strong>总方法数</strong>。</em></p>
1212

1313
<p>&nbsp;</p>
14-
<p><strong class="example">Example 1:</strong></p>
14+
15+
<p><b>示例 1:</b></p>
1516

1617
<pre>
17-
<strong>Input:</strong> n = 5, limit = 2
18-
<strong>Output:</strong> 3
19-
<strong>Explanation:</strong> There are 3 ways to distribute 5 candies such that no child gets more than 2 candies: (1, 2, 2), (2, 1, 2) and (2, 2, 1).
18+
<b>输入:</b>n = 5, limit = 2
19+
<b>输出:</b>3
20+
<b>解释:</b>有 3 种方式将 5 个糖果分发给 3 个孩子,使得每个孩子得到不超过 2 个糖果:(1, 2, 2), (2, 1, 2) (2, 2, 1)
2021
</pre>
2122

22-
<p><strong class="example">Example 2:</strong></p>
23+
<p><b>示例 2:</b></p>
2324

2425
<pre>
25-
<strong>Input:</strong> n = 3, limit = 3
26-
<strong>Output:</strong> 10
27-
<strong>Explanation:</strong> There are 10 ways to distribute 3 candies such that no child gets more than 3 candies: (0, 0, 3), (0, 1, 2), (0, 2, 1), (0, 3, 0), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0) and (3, 0, 0).
26+
<b>输入:</b>n = 3, limit = 3
27+
<b>输出:</b>10
28+
<b>解释:</b>有 10 种方式将 3 个糖果分发给 3 个孩子,使得每个孩子得到不超过 3 个糖果:(0, 0, 3), (0, 1, 2), (0, 2, 1), (0, 3, 0), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0) (3, 0, 0)
2829
</pre>
2930

3031
<p>&nbsp;</p>
31-
<p><strong>Constraints:</strong></p>
32+
33+
<p><b>提示:</b></p>
3234

3335
<ul>
3436
<li><code>1 &lt;= n &lt;= 10<sup>8</sup></code></li>

solution/DATABASE_README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
| 2853 | [最高薪水差异](/solution/2800-2899/2853.Highest%20Salaries%20Difference/README.md) | `数据库` | 简单 | 🔒 |
247247
| 2854 | [滚动平均步数](/solution/2800-2899/2854.Rolling%20Average%20Steps/README.md) | `数据库` | 中等 | 🔒 |
248248
| 2893 | [计算每个区间内的订单](/solution/2800-2899/2893.Calculate%20Orders%20Within%20Each%20Interval/README.md) | `数据库` | 中等 | 🔒 |
249-
| 2922 | [Market Analysis III](/solution/2900-2999/2922.Market%20Analysis%20III/README.md) | | 中等 | 🔒 |
249+
| 2922 | [市场分析 III](/solution/2900-2999/2922.Market%20Analysis%20III/README.md) | | 中等 | 🔒 |
250250

251251
## 版权
252252

solution/JAVASCRIPT_README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
| 2629 | [复合函数](/solution/2600-2699/2629.Function%20Composition/README.md) | | 简单 | |
2525
| 2630 | [记忆函数 II](/solution/2600-2699/2630.Memoize%20II/README.md) | | 困难 | |
2626
| 2631 | [分组](/solution/2600-2699/2631.Group%20By/README.md) | | 中等 | |
27-
| 2632 | [柯里化](/solution/2600-2699/2632.Curry/README.md) | | 困难 | 🔒 |
27+
| 2632 | [柯里化](/solution/2600-2699/2632.Curry/README.md) | | 中等 | 🔒 |
2828
| 2633 | [将对象转换为 JSON 字符串](/solution/2600-2699/2633.Convert%20Object%20to%20JSON%20String/README.md) | | 中等 | 🔒 |
2929
| 2634 | [过滤数组中的元素](/solution/2600-2699/2634.Filter%20Elements%20from%20Array/README.md) | | 简单 | |
3030
| 2635 | [转换数组中的每个元素](/solution/2600-2699/2635.Apply%20Transform%20Over%20Each%20Element%20in%20Array/README.md) | | 简单 | |

solution/JAVASCRIPT_README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Press <kbd>Control</kbd> + <kbd>F</kbd>(or <kbd>Command</kbd> + <kbd>F</kbd> on
2222
| 2629 | [Function Composition](/solution/2600-2699/2629.Function%20Composition/README_EN.md) | | Easy | |
2323
| 2630 | [Memoize II](/solution/2600-2699/2630.Memoize%20II/README_EN.md) | | Hard | |
2424
| 2631 | [Group By](/solution/2600-2699/2631.Group%20By/README_EN.md) | | Medium | |
25-
| 2632 | [Curry](/solution/2600-2699/2632.Curry/README_EN.md) | | Hard | 🔒 |
25+
| 2632 | [Curry](/solution/2600-2699/2632.Curry/README_EN.md) | | Medium | 🔒 |
2626
| 2633 | [Convert Object to JSON String](/solution/2600-2699/2633.Convert%20Object%20to%20JSON%20String/README_EN.md) | | Medium | 🔒 |
2727
| 2634 | [Filter Elements from Array](/solution/2600-2699/2634.Filter%20Elements%20from%20Array/README_EN.md) | | Easy | |
2828
| 2635 | [Apply Transform Over Each Element in Array](/solution/2600-2699/2635.Apply%20Transform%20Over%20Each%20Element%20in%20Array/README_EN.md) | | Easy | |

0 commit comments

Comments
 (0)