Skip to content

Commit c08d806

Browse files
authored
feat: update lc problems (doocs#3528)
1 parent 6ee014b commit c08d806

File tree

66 files changed

+2918
-53
lines changed

Some content is hidden

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

66 files changed

+2918
-53
lines changed

solution/0100-0199/0153.Find Minimum in Rotated Sorted Array/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tags:
2828

2929
<p>Given the sorted rotated array <code>nums</code> of <strong>unique</strong> elements, return <em>the minimum element of this array</em>.</p>
3030

31-
<p>You must write an algorithm that runs in&nbsp;<code>O(log n) time.</code></p>
31+
<p>You must write an algorithm that runs in&nbsp;<code>O(log n) time</code>.</p>
3232

3333
<p>&nbsp;</p>
3434
<p><strong class="example">Example 1:</strong></p>

solution/0300-0399/0345.Reverse Vowels of a String/README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,27 @@ tags:
2323

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

26-
<p><strong>示例 1:</strong></p>
26+
<p><strong class="example">示例 1:</strong></p>
2727

28-
<pre>
29-
<strong>输入:</strong>s = "hello"
30-
<strong>输出:</strong>"holle"
31-
</pre>
28+
<div class="example-block">
29+
<p><strong>输入:</strong><span class="example-io">s = "IceCreAm"</span></p>
3230

33-
<p><strong>示例 2:</strong></p>
31+
<p><span class="example-io"><b>输出:</b>"AceCreIm"</span></p>
3432

35-
<pre>
36-
<strong>输入:</strong>s = "leetcode"
37-
<strong>输出:</strong>"leotcede"</pre>
33+
<p><strong>解释:</strong></p>
34+
35+
<p><code>s</code>&nbsp;中的元音是&nbsp;<code>['I', 'e', 'e', 'A']</code>。反转这些元音,<code>s</code> 变为&nbsp;<code>"AceCreIm"</code>.</p>
36+
</div>
37+
38+
<p><strong class="example">示例 2:</strong></p>
39+
40+
<div class="example-block">
41+
<p><span class="example-io"><b>输入:</b>s = "leetcode"</span></p>
42+
43+
<p><strong>输出:</strong><span class="example-io">"leotcede"</span></p>
3844

3945
<p>&nbsp;</p>
46+
</div>
4047

4148
<p><strong>提示:</strong></p>
4249

solution/0300-0399/0345.Reverse Vowels of a String/README_EN.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,25 @@ tags:
2323

2424
<p>&nbsp;</p>
2525
<p><strong class="example">Example 1:</strong></p>
26-
<pre><strong>Input:</strong> s = "hello"
27-
<strong>Output:</strong> "holle"
28-
</pre><p><strong class="example">Example 2:</strong></p>
29-
<pre><strong>Input:</strong> s = "leetcode"
30-
<strong>Output:</strong> "leotcede"
31-
</pre>
26+
27+
<div class="example-block">
28+
<p><strong>Input:</strong> <span class="example-io">s = &quot;IceCreAm&quot;</span></p>
29+
30+
<p><strong>Output:</strong> <span class="example-io">&quot;AceCreIm&quot;</span></p>
31+
32+
<p><strong>Explanation:</strong></p>
33+
34+
<p>The vowels in <code>s</code> are <code>[&#39;I&#39;, &#39;e&#39;, &#39;e&#39;, &#39;A&#39;]</code>. On reversing the vowels, s becomes <code>&quot;AceCreIm&quot;</code>.</p>
35+
</div>
36+
37+
<p><strong class="example">Example 2:</strong></p>
38+
39+
<div class="example-block">
40+
<p><strong>Input:</strong> <span class="example-io">s = &quot;leetcode&quot;</span></p>
41+
42+
<p><strong>Output:</strong> <span class="example-io">&quot;leotcede&quot;</span></p>
43+
</div>
44+
3245
<p>&nbsp;</p>
3346
<p><strong>Constraints:</strong></p>
3447

solution/0400-0499/0461.Hamming Distance/README_EN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ The above arrows point to positions where the corresponding bits are different.
4747
<li><code>0 &lt;=&nbsp;x, y &lt;= 2<sup>31</sup> - 1</code></li>
4848
</ul>
4949

50+
<p>&nbsp;</p>
51+
<p><strong>Note:</strong> This question is the same as <a href="https://leetcode.com/problems/minimum-bit-flips-to-convert-number/description/" target="_blank"> 2220: Minimum Bit Flips to Convert Number.</a></p>
52+
5053
<!-- description:end -->
5154

5255
## Solutions

solution/1100-1199/1189.Maximum Number of Balloons/README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,34 @@ tags:
2020

2121
<!-- description:start -->
2222

23-
<p>给你一个字符串&nbsp;<code>text</code>,你需要使用 <code>text</code> 中的字母来拼凑尽可能多的单词&nbsp;<strong>&quot;balloon&quot;(气球)</strong>。</p>
23+
<p>给你一个字符串&nbsp;<code>text</code>,你需要使用 <code>text</code> 中的字母来拼凑尽可能多的单词&nbsp;<strong>"balloon"(气球)</strong>。</p>
2424

25-
<p>字符串&nbsp;<code>text</code> 中的每个字母最多只能被使用一次。请你返回最多可以拼凑出多少个单词&nbsp;<strong>&quot;balloon&quot;</strong>。</p>
25+
<p>字符串&nbsp;<code>text</code> 中的每个字母最多只能被使用一次。请你返回最多可以拼凑出多少个单词&nbsp;<strong>"balloon"</strong>。</p>
2626

2727
<p>&nbsp;</p>
2828

29-
<p><strong>示例 1:</strong></p>
29+
<p><strong class="example">示例 1:</strong></p>
3030

31-
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1100-1199/1189.Maximum%20Number%20of%20Balloons/images/1536_ex1_upd.jpeg" style="height: 35px; width: 154px;"></strong></p>
31+
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1100-1199/1189.Maximum%20Number%20of%20Balloons/images/1536_ex1_upd.jpeg" style="height: 35px; width: 154px;" /></strong></p>
3232

33-
<pre><strong>输入:</strong>text = &quot;nlaebolko&quot;
33+
<pre>
34+
<strong>输入:</strong>text = "nlaebolko"
3435
<strong>输出:</strong>1
3536
</pre>
3637

37-
<p><strong>示例 2:</strong></p>
38+
<p><strong class="example">示例 2:</strong></p>
3839

39-
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1100-1199/1189.Maximum%20Number%20of%20Balloons/images/1536_ex2_upd.jpeg" style="height: 35px; width: 233px;"></strong></p>
40+
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1100-1199/1189.Maximum%20Number%20of%20Balloons/images/1536_ex2_upd.jpeg" style="height: 35px; width: 233px;" /></strong></p>
4041

41-
<pre><strong>输入:</strong>text = &quot;loonbalxballpoon&quot;
42+
<pre>
43+
<strong>输入:</strong>text = "loonbalxballpoon"
4244
<strong>输出:</strong>2
4345
</pre>
4446

45-
<p><strong>示例 3:</strong></p>
47+
<p><strong class="example">示例 3:</strong></p>
4648

47-
<pre><strong>输入:</strong>text = &quot;leetcode&quot;
49+
<pre>
50+
<strong>输入:</strong>text = "leetcode"
4851
<strong>输出:</strong>0
4952
</pre>
5053

@@ -53,10 +56,14 @@ tags:
5356
<p><strong>提示:</strong></p>
5457

5558
<ul>
56-
<li><code>1 &lt;= text.length &lt;= 10^4</code></li>
59+
<li><code>1 &lt;= text.length &lt;= 10<sup>4</sup></code></li>
5760
<li><code>text</code>&nbsp;全部由小写英文字母组成</li>
5861
</ul>
5962

63+
<p>&nbsp;</p>
64+
65+
<p><strong>注意:</strong>本题与&nbsp;<a href="https://leetcode.cn/problems/rearrange-characters-to-make-target-string/">2287. 重排字符形成目标字符串</a>&nbsp;相同。</p>
66+
6067
<!-- description:end -->
6168

6269
## 解法

solution/1100-1199/1189.Maximum Number of Balloons/README_EN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ tags:
5858
<li><code>text</code> consists of lower case English letters only.</li>
5959
</ul>
6060

61+
<p>&nbsp;</p>
62+
<p><strong>Note:</strong> This question is the same as <a href="https://leetcode.com/problems/rearrange-characters-to-make-target-string/description/" target="_blank"> 2287: Rearrange Characters to Make Target String.</a></p>
63+
6164
<!-- description:end -->
6265

6366
## Solutions

solution/1200-1299/1251.Average Selling Price/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ tags:
4848

4949
<p>&nbsp;</p>
5050

51-
<p>编写解决方案以查找每种产品的平均售价。<code>average_price</code> 应该 <strong>四舍五入到小数点后两位</strong>。</p>
51+
<p>编写解决方案以查找每种产品的平均售价。<code>average_price</code> 应该 <strong>四舍五入到小数点后两位</strong>。如果产品没有任何售出,则假设其平均售价为 0。</p>
5252

5353
<p>返回结果表 <strong>无顺序要求</strong> 。</p>
5454

solution/1200-1299/1251.Average Selling Price/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Each row of this table indicates the date, units, and product_id of each product
5050

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

53-
<p>Write a solution to find the average selling price for each product. <code>average_price</code> should be <strong>rounded to 2 decimal places</strong>.</p>
53+
<p>Write a solution to find the average selling price for each product. <code>average_price</code> should be <strong>rounded to 2 decimal places</strong>. If a product does not have any sold units, its average selling price is assumed to be 0.</p>
5454

5555
<p>Return the result table in <strong>any order</strong>.</p>
5656

solution/1600-1699/1683.Invalid Tweets/README_EN.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ This table contains all the tweets in a social media app.
4343
<pre>
4444
<strong>Input:</strong>
4545
Tweets table:
46-
+----------+----------------------------------+
47-
| tweet_id | content |
48-
+----------+----------------------------------+
49-
| 1 | Vote for Biden |
50-
| 2 | Let us make America great again! |
51-
+----------+----------------------------------+
46+
+----------+-----------------------------------+
47+
| tweet_id | content |
48+
+----------+-----------------------------------+
49+
| 1 | Let us Code |
50+
| 2 | More than fifteen chars are here! |
51+
+----------+-----------------------------------+
5252
<strong>Output:</strong>
5353
+----------+
5454
| tweet_id |
5555
+----------+
5656
| 2 |
5757
+----------+
5858
<strong>Explanation:</strong>
59-
Tweet 1 has length = 14. It is a valid tweet.
60-
Tweet 2 has length = 32. It is an invalid tweet.
59+
Tweet 1 has length = 11. It is a valid tweet.
60+
Tweet 2 has length = 33. It is an invalid tweet.
6161
</pre>
6262

6363
<!-- description:end -->

solution/1700-1799/1743.Restore the Array From Adjacent Pairs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/1700-1799/1743.Re
55
rating: 1579
66
source: 第 226 场周赛 Q2
77
tags:
8+
- 深度优先搜索
89
- 数组
910
- 哈希表
1011
---

0 commit comments

Comments
 (0)