Skip to content

Commit 8e6eeaf

Browse files
authored
chore: update lc problems (doocs#1795)
1 parent eff72ba commit 8e6eeaf

File tree

22 files changed

+94
-103
lines changed

22 files changed

+94
-103
lines changed

solution/0000-0099/0074.Search a 2D Matrix/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p>给你一个满足下述两条属性的 <code>m x n</code> 整数矩阵:</p>
1010

1111
<ul>
12-
<li>每行中的整数从左到右按非递减顺序排列。</li>
12+
<li>每行中的整数从左到右按非严格递增顺序排列。</li>
1313
<li>每行的第一个整数大于前一行的最后一个整数。</li>
1414
</ul>
1515

solution/0100-0199/0138.Copy List with Random Pointer/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
<li><code>Node.random</code>&nbsp;为&nbsp;<code>null</code> 或指向链表中的节点。</li>
6363
</ul>
6464

65-
<p>注意:本题与主站 138 题相同:<a href="https://leetcode.cn/problems/copy-list-with-random-pointer/" rel="noopener noreferrer" target="_blank">https://leetcode.cn/problems/copy-list-with-random-pointer/</a></p>
66-
6765
<p>&nbsp;</p>
6866

6967
## 解法

solution/0600-0699/0683.K Empty Slots/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<p><code>n</code>&nbsp;个灯泡排成一行,编号从 <code>1</code> 到<meta charset="UTF-8" />&nbsp;<code>n</code>&nbsp;。最初,所有灯泡都关闭。每天&nbsp;<strong>只打开一个</strong>&nbsp;灯泡,直到<meta charset="UTF-8" />&nbsp;<code>n</code>&nbsp;天后所有灯泡都打开。</p>
1010

11-
<p>给你一个长度为<meta charset="UTF-8" />&nbsp;<code>n</code>&nbsp;的灯泡数组 <code>blubs</code> ,其中 <code>bulls[i] = x</code> 意味着在第 <code>(i+1)</code> 天,我们会把在位置 <code>x</code> 的灯泡打开,其中 <code>i</code> <strong>从 0 开始</strong>,<code>x</code> <strong>从 1 开始</strong>。</p>
11+
<p>给你一个长度为<meta charset="UTF-8" />&nbsp;<code>n</code>&nbsp;的灯泡数组 <code>blubs</code> ,其中 <code>bulbs[i] = x</code> 意味着在第 <code>(i+1)</code> 天,我们会把在位置 <code>x</code> 的灯泡打开,其中 <code>i</code> <strong>从 0 开始</strong>,<code>x</code> <strong>从 1 开始</strong>。</p>
1212

1313
<p>给你一个整数<meta charset="UTF-8" />&nbsp;<code>k</code>&nbsp;,请返回<em>恰好有两个打开的灯泡,且它们中间 <strong>正好</strong> 有<meta charset="UTF-8" />&nbsp;<code>k</code>&nbsp;&nbsp;<strong>全部关闭的</strong> 灯泡的 <strong>最小的天数</strong> </em>。<em>如果不存在这种情况,返回 <code>-1</code> 。</em></p>
1414

solution/0900-0999/0981.Time Based Key-Value Store/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<ul>
1212
<li><code>TimeMap()</code> Initializes the object of the data structure.</li>
13-
<li><code>void set(String key, String value, int timestamp)</code> Stores the key <code>key</code> with the value <code>value </code>at the given time <code>timestamp</code>.</li>
13+
<li><code>void set(String key, String value, int timestamp)</code> Stores the key <code>key</code> with the value <code>value</code> at the given time <code>timestamp</code>.</li>
1414
<li><code>String get(String key, int timestamp)</code> Returns a value such that <code>set</code> was called previously, with <code>timestamp_prev &lt;= timestamp</code>. If there are multiple such values, it returns the value associated with the largest <code>timestamp_prev</code>. If there are no values, it returns <code>&quot;&quot;</code>.</li>
1515
</ul>
1616

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ item_id is the primary key (column with unique values) of this table.
5353

5454
<p>&nbsp;</p>
5555

56-
<p>Write a solution to find for each user whether the brand of the second item (by date) they sold is their favorite brand. If a user sold less than two items, report the answer for that user as no. It is guaranteed that no seller sold more than one item in a day.</p>
56+
<p>Write a solution&nbsp;to find for each user, the join date and the number of orders they made as a buyer in <code>2019</code>.</p>
5757

5858
<p>Return the result table in <strong>any order</strong>.</p>
5959

60-
<p>The result format is in the following example.</p>
60+
<p>The&nbsp;result format is in the following example.</p>
6161

6262
<p>&nbsp;</p>
6363
<p><strong class="example">Example 1:</strong></p>

solution/1300-1399/1349.Maximum Students Taking Exam/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<p>Given a <code>m&nbsp;* n</code>&nbsp;matrix <code>seats</code>&nbsp;&nbsp;that represent seats distributions&nbsp;in a classroom.&nbsp;If a seat&nbsp;is&nbsp;broken, it is denoted by <code>&#39;#&#39;</code> character otherwise it is denoted by a <code>&#39;.&#39;</code> character.</p>
88

9-
<p>Students can see the answers of those sitting next to the left, right, upper left and upper right, but he cannot see the answers of the student sitting&nbsp;directly in front or behind him. Return the <strong>maximum </strong>number of students that can take the exam together&nbsp;without any cheating being possible..</p>
9+
<p>Students can see the answers of those sitting next to the left, right, upper left and upper right, but he cannot see the answers of the student sitting&nbsp;directly in front or behind him. Return the <strong>maximum </strong>number of students that can take the exam together&nbsp;without any cheating being possible.</p>
1010

1111
<p>Students must be placed in seats in good condition.</p>
1212

solution/1400-1499/1409.Queries on a Permutation With Key/README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,41 @@
66

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

9-
<p>给你一个待查数组 <code>queries</code> ,数组中的元素为 <code>1</code> 到 <code>m</code> 之间的正整数。 请你根据以下规则处理所有待查项 <code>queries[i]</code>(从 <code>i=0</code> 到 <code>i=queries.length-1</code>):</p>
9+
<p>给定一个正整数数组&nbsp;<code>queries</code> ,其取值范围在&nbsp;<code>1</code> 到 <code>m</code> 之间。 请你根据以下规则按顺序处理所有&nbsp;<code>queries[i]</code>(从 <code>i=0</code> 到 <code>i=queries.length-1</code>):</p>
1010

1111
<ul>
12-
<li>一开始,排列 <code>P=[1,2,3,...,m]</code>。</li>
13-
<li>对于当前的 <code>i</code> ,请你找出待查项 <code>queries[i]</code> 在排列 <code>P</code> 中的位置(<strong>下标从 0 开始</strong>),然后将其从原位置移动到排列 <code>P</code> 的起始位置(即下标为 0 处)。注意, <code>queries[i]</code><code>P</code> 中的位置就是 <code>queries[i]</code> 的查询结果。</li>
12+
<li>首先,你有一个排列&nbsp;<code>P=[1,2,3,...,m]</code>。</li>
13+
<li>对于当前的 <code>i</code> ,找到&nbsp;<code>queries[i]</code> 在排列 <code>P</code> 中的位置(<b>从 0 开始索引</b>),然后将它移到排列&nbsp;<code>P</code> 的开头(即下标为 0 处)。注意, <code>queries[i]</code>&nbsp;的查询结果是 <code>queries[i]</code> <code>P</code> 中移动前的位置。</li>
1414
</ul>
1515

16-
<p>请你以数组形式返回待查数组&nbsp; <code>queries</code> 的查询结果。</p>
16+
<p>返回一个数组,包含从给定 &nbsp;<code>queries</code>&nbsp;中查询到的结果。</p>
1717

1818
<p>&nbsp;</p>
1919

2020
<p><strong>示例 1:</strong></p>
2121

22-
<pre><strong>输入:</strong>queries = [3,1,2,1], m = 5
22+
<pre>
23+
<strong>输入:</strong>queries = [3,1,2,1], m = 5
2324
<strong>输出:</strong>[2,1,2,1]
24-
<strong>解释:</strong>待查数组 queries 处理如下
25-
对于 i=0: queries[i]=3, P=[1,2,3,4,5], 3 在 P 中的位置是 <strong>2</strong>,接着我们把 3 移动到 P 的起始位置,得到 P=[3,1,2,4,5] 。
26-
对于 i=1: queries[i]=1, P=[3,1,2,4,5], 1 在 P 中的位置是 <strong>1</strong>,接着我们把 1 移动到 P 的起始位置,得到 P=[1,3,2,4,5] 。
27-
对于 i=2: queries[i]=2, P=[1,3,2,4,5], 2 在 P 中的位置是 <strong>2</strong>,接着我们把 2 移动到 P 的起始位置,得到 P=[2,1,3,4,5] 。
28-
对于 i=3: queries[i]=1, P=[2,1,3,4,5], 1 在 P 中的位置是 <strong>1</strong>,接着我们把 1 移动到 P 的起始位置,得到 P=[1,2,3,4,5] 。
29-
因此,返回的结果数组为 [2,1,2,1] 。
25+
<strong>解释:处理</strong> queries 的过程如下
26+
对于 i=0: queries[i]=3, P=[1,2,3,4,5], 3 在 P 中的位置是 <strong>2</strong>,然后我们把 3 移动到 P 的开头,得到 P=[3,1,2,4,5] 。
27+
对于 i=1: queries[i]=1, P=[3,1,2,4,5], 1 在 P 中的位置是 <strong>1</strong>,然后我们把 1 移动到 P 的开头,得到 P=[1,3,2,4,5] 。
28+
对于 i=2: queries[i]=2, P=[1,3,2,4,5], 2 在 P 中的位置是 <strong>2</strong>,然后我们把 2 移动到 P 的开头,得到 P=[2,1,3,4,5] 。
29+
对于 i=3: queries[i]=1, P=[2,1,3,4,5], 1 在 P 中的位置是 <strong>1</strong>,然后我们把 1 移动到 P 的开头,得到 P=[1,2,3,4,5] 。
30+
因此,包含结果的数组为 [2,1,2,1] 。
3031
</pre>
3132

3233
<p><strong>示例 2:</strong></p>
3334

34-
<pre><strong>输入:</strong>queries = [4,1,2,2], m = 4
35+
<pre>
36+
<strong>输入:</strong>queries = [4,1,2,2], m = 4
3537
<strong>输出:</strong>[3,1,2,0]
3638
</pre>
3739

3840
<p><strong>示例 3:</strong></p>
3941

40-
<pre><strong>输入:</strong>queries = [7,5,5,8,3], m = 8
42+
<pre>
43+
<strong>输入:</strong>queries = [7,5,5,8,3], m = 8
4144
<strong>输出:</strong>[6,5,0,7,5]
4245
</pre>
4346

solution/1400-1499/1409.Queries on a Permutation With Key/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<ul>
1010
<li>In the beginning, you have the permutation <code>P=[1,2,3,...,m]</code>.</li>
11-
<li>For the current <code>i</code>, find the position of <code>queries[i]</code> in the permutation <code>P</code> (<strong>indexing from 0</strong>) and then move this at the beginning of the permutation <code>P.</code>&nbsp;Notice that the position of <code>queries[i]</code> in <code>P</code> is the result for <code>queries[i]</code>.</li>
11+
<li>For the current <code>i</code>, find the position of <code>queries[i]</code> in the permutation <code>P</code> (<strong>indexing from 0</strong>) and then move this at the beginning of the permutation <code>P</code>. Notice that the position of <code>queries[i]</code> in <code>P</code> is the result for <code>queries[i]</code>.</li>
1212
</ul>
1313

1414
<p>Return an array containing the result for the given <code>queries</code>.</p>

solution/1400-1499/1420.Build Array Where You Can Find The Maximum Exactly K Comparisons/README.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,44 @@
66

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

9-
<p>给你三个整数 <code>n</code>、<code>m</code> 和 <code>k</code> 。下图描述的算法用于找出正整数数组中最大的元素。</p>
9+
<p>给定三个整数 <code>n</code>、<code>m</code> 和 <code>k</code> 。考虑使用下图描述的算法找出正整数数组中最大的元素。</p>
1010

11-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1400-1499/1420.Build%20Array%20Where%20You%20Can%20Find%20The%20Maximum%20Exactly%20K%20Comparisons/images/e.png" style="height: 372px; width: 424px;"></p>
11+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1400-1499/1420.Build%20Array%20Where%20You%20Can%20Find%20The%20Maximum%20Exactly%20K%20Comparisons/images/e.png" style="height: 372px; width: 424px;" /></p>
1212

13-
<p>请你生成一个具有下述属性的数组 <code>arr</code> :</p>
13+
<p>请你构建一个具有以下属性的数组 <code>arr</code> :</p>
1414

1515
<ul>
16-
<li><code>arr</code> 中有 <code>n</code> 个整数。</li>
16+
<li><code>arr</code> 中包含确切的&nbsp;<code>n</code> 个整数。</li>
1717
<li><code>1 &lt;= arr[i] &lt;= m</code> 其中 <code>(0 &lt;= i &lt; n)</code> 。</li>
18-
<li>将上面提到的算法应用于 <code>arr</code> ,<code>search_cost</code> 的值等于 <code>k</code> 。</li>
18+
<li>将上面提到的算法应用于 <code>arr</code>&nbsp;之后,<code>search_cost</code> 的值等于 <code>k</code> 。</li>
1919
</ul>
2020

21-
<p>返回上述条件下生成数组 <code>arr</code> 的 <strong>方法数</strong> ,由于答案可能会很大,所以 <strong>必须</strong> 对 <code>10^9 + 7</code> 取余。</p>
21+
<p>返回在满足上述条件的情况下构建数组 <code>arr</code> 的 <em>方法数量</em>&nbsp;,由于答案可能会很大,所以 <strong>必须</strong> 对 <code>10^9 + 7</code> 取余。</p>
2222

2323
<p>&nbsp;</p>
2424

2525
<p><strong>示例 1:</strong></p>
2626

27-
<pre><strong>输入:</strong>n = 2, m = 3, k = 1
27+
<pre>
28+
<strong>输入:</strong>n = 2, m = 3, k = 1
2829
<strong>输出:</strong>6
2930
<strong>解释:</strong>可能的数组分别为 [1, 1], [2, 1], [2, 2], [3, 1], [3, 2] [3, 3]
3031
</pre>
3132

3233
<p><strong>示例 2:</strong></p>
3334

34-
<pre><strong>输入:</strong>n = 5, m = 2, k = 3
35+
<pre>
36+
<strong>输入:</strong>n = 5, m = 2, k = 3
3537
<strong>输出:</strong>0
3638
<strong>解释:</strong>没有数组可以满足上述条件
3739
</pre>
3840

3941
<p><strong>示例 3:</strong></p>
4042

41-
<pre><strong>输入:</strong>n = 9, m = 1, k = 1
43+
<pre>
44+
<strong>输入:</strong>n = 9, m = 1, k = 1
4245
<strong>输出:</strong>1
43-
<strong>解释:</strong>可能的数组只有 [1, 1, 1, 1, 1, 1, 1, 1, 1]
44-
</pre>
45-
46-
<p><strong>示例 4:</strong></p>
47-
48-
<pre><strong>输入:</strong>n = 50, m = 100, k = 25
49-
<strong>输出:</strong>34549172
50-
<strong>解释:</strong>不要忘了对 1000000007 取余
51-
</pre>
52-
53-
<p><strong>示例 5:</strong></p>
54-
55-
<pre><strong>输入:</strong>n = 37, m = 17, k = 7
56-
<strong>输出:</strong>418930126
46+
<strong>解释:</strong>唯一可能的数组是 [1, 1, 1, 1, 1, 1, 1, 1, 1]
5747
</pre>
5848

5949
<p>&nbsp;</p>

solution/1400-1499/1420.Build Array Where You Can Find The Maximum Exactly K Comparisons/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<pre>
3131
<strong>Input:</strong> n = 5, m = 2, k = 3
3232
<strong>Output:</strong> 0
33-
<strong>Explanation:</strong> There are no possible arrays that satisify the mentioned conditions.
33+
<strong>Explanation:</strong> There are no possible arrays that satisfy the mentioned conditions.
3434
</pre>
3535

3636
<p><strong class="example">Example 3:</strong></p>

0 commit comments

Comments
 (0)