Skip to content

Commit 36476c8

Browse files
committed
feat: update lc problems
1 parent 39a6e50 commit 36476c8

File tree

12 files changed

+41
-44
lines changed

12 files changed

+41
-44
lines changed

solution/0000-0099/0050.Pow(x, n)/README_EN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<ul>
3636
<li><code>-100.0 &lt; x &lt; 100.0</code></li>
3737
<li><code>-2<sup>31</sup> &lt;= n &lt;= 2<sup>31</sup>-1</code></li>
38+
<li><code>n</code> is an integer.</li>
3839
<li><code>-10<sup>4</sup> &lt;= x<sup>n</sup> &lt;= 10<sup>4</sup></code></li>
3940
</ul>
4041

solution/0300-0399/0320.Generalized Abbreviation/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
<ul>
1010
<li>For example, <code>&quot;abcde&quot;</code> can be abbreviated into:
11+
1112
<ul>
1213
<li><code>&quot;a3e&quot;</code> (<code>&quot;bcd&quot;</code> turned into <code>&quot;3&quot;</code>)</li>
1314
<li><code>&quot;1bcd1&quot;</code> (<code>&quot;a&quot;</code> and <code>&quot;e&quot;</code> both turned into <code>&quot;1&quot;</code>)</li>
@@ -21,6 +22,7 @@
2122
<li><code>&quot;22de&quot;</code> (<code>&quot;ab&quot;</code> turned into <code>&quot;2&quot;</code> and <code>&quot;bc&quot;</code> turned into <code>&quot;2&quot;</code>) is invalid as the substring chosen overlap.</li>
2223
</ul>
2324
</li>
25+
2426
</ul>
2527

2628
<p>Given a string <code>word</code>, return <em>a list of all the possible <strong>generalized abbreviations</strong> of</em> <code>word</code>. Return the answer in <strong>any order</strong>.</p>

solution/0300-0399/0363.Max Sum of Rectangle No Larger Than K/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<ul>
3131
<li><code>m == matrix.length</code></li>
3232
<li><code>n == matrix[i].length</code></li>
33-
<li><code>1 &lt;= m, n &lt;= 200</code></li>
33+
<li><code>1 &lt;= m, n &lt;= 100</code></li>
3434
<li><code>-100 &lt;= matrix[i][j] &lt;= 100</code></li>
3535
<li><code>-10<sup>5</sup> &lt;= k &lt;= 10<sup>5</sup></code></li>
3636
</ul>

solution/0400-0499/0462.Minimum Moves to Equal Array Elements II/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# [462. 最少移动次数使数组元素相等 II](https://leetcode.cn/problems/minimum-moves-to-equal-array-elements-ii)
1+
# [462. 最小操作次数使数组元素相等 II](https://leetcode.cn/problems/minimum-moves-to-equal-array-elements-ii)
22

33
[English Version](/solution/0400-0499/0462.Minimum%20Moves%20to%20Equal%20Array%20Elements%20II/README_EN.md)
44

55
## 题目描述
66

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

9-
<p>给你一个长度为 <code>n</code> 的整数数组 <code>nums</code> ,返回使所有数组元素相等需要的最少移动数。</p>
9+
<p>给你一个长度为 <code>n</code> 的整数数组 <code>nums</code> ,返回使所有数组元素相等需要的最小操作数。</p>
1010

11-
<p>在一步操作中,你可以使数组中的一个元素加 <code>1</code> 或者减 <code>1</code> 。</p>
11+
<p>在一次操作中,你可以使数组中的一个元素加 <code>1</code> 或者减 <code>1</code> 。</p>
1212

1313
<p>&nbsp;</p>
1414

@@ -18,7 +18,7 @@
1818
<strong>输入:</strong>nums = [1,2,3]
1919
<strong>输出:</strong>2
2020
<strong>解释:</strong>
21-
只需要两步操作(每步操作指南使一个元素加 1 或减 1):
21+
只需要两次操作(每次操作指南使一个元素加 1 或减 1):
2222
[<strong><em>1</em></strong>,2,3] =&gt; [2,2,<strong><em>3</em></strong>] =&gt; [2,2,2]
2323
</pre>
2424

solution/0600-0699/0621.Task Scheduler/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ public:
132132
133133
### **Go**
134134
135-
136135
```go
137136
func leastInterval(tasks []byte, n int) int {
138137
cnt := make([]int, 26)

solution/0600-0699/0698.Partition to K Equal Sum Subsets/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class Solution {
131131
private int[] nums;
132132
private int n;
133133
private int s;
134-
134+
135135
public boolean canPartitionKSubsets(int[] nums, int k) {
136136
for (int v : nums) {
137137
s += v;

solution/1400-1499/1475.Final Prices With a Special Discount in a Shop/README_EN.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44

55
## Description
66

7-
<p>Given the array <code>prices</code> where <code>prices[i]</code> is the price of the <code>ith</code> item in a shop. There is a special discount for items in the shop, if you buy the <code>ith</code> item, then you will receive a discount equivalent to <code>prices[j]</code> where <code>j</code> is the <strong>minimum</strong>&nbsp;index such that <code>j &gt; i</code> and <code>prices[j] &lt;= prices[i]</code>, otherwise, you will not receive any discount at all.</p>
7+
<p>You are given an integer array <code>prices</code> where <code>prices[i]</code> is the price of the <code>i<sup>th</sup></code> item in a shop.</p>
88

9-
<p><em>Return an array where the <code>ith</code> element is the final price you will pay for the <code>ith</code> item of the shop considering the special discount.</em></p>
9+
<p>There is a special discount for items in the shop. If you buy the <code>i<sup>th</sup></code> item, then you will receive a discount equivalent to <code>prices[j]</code> where <code>j</code> is the minimum index such that <code>j &gt; i</code> and <code>prices[j] &lt;= prices[i]</code>. Otherwise, you will not receive any discount at all.</p>
10+
11+
<p>Return an integer array <code>answer</code> where <code>answer[i]</code> is the final price you will pay for the <code>i<sup>th</sup></code> item of the shop, considering the special discount.</p>
1012

1113
<p>&nbsp;</p>
1214
<p><strong>Example 1:</strong></p>
1315

1416
<pre>
1517
<strong>Input:</strong> prices = [8,4,6,2,3]
1618
<strong>Output:</strong> [4,2,4,2,3]
17-
<strong>Explanation:</strong>&nbsp;
18-
For item 0 with price[0]=8 you will receive a discount equivalent to prices[1]=4, therefore, the final price you will pay is 8 - 4 = 4.&nbsp;
19-
For item 1 with price[1]=4 you will receive a discount equivalent to prices[3]=2, therefore, the final price you will pay is 4 - 2 = 2.&nbsp;
20-
For item 2 with price[2]=6 you will receive a discount equivalent to prices[3]=2, therefore, the final price you will pay is 6 - 2 = 4.&nbsp;
19+
<strong>Explanation:</strong>
20+
For item 0 with price[0]=8 you will receive a discount equivalent to prices[1]=4, therefore, the final price you will pay is 8 - 4 = 4.
21+
For item 1 with price[1]=4 you will receive a discount equivalent to prices[3]=2, therefore, the final price you will pay is 4 - 2 = 2.
22+
For item 2 with price[2]=6 you will receive a discount equivalent to prices[3]=2, therefore, the final price you will pay is 6 - 2 = 4.
2123
For items 3 and 4 you will not receive any discount at all.
2224
</pre>
2325

@@ -41,7 +43,7 @@ For items 3 and 4 you will not receive any discount at all.
4143

4244
<ul>
4345
<li><code>1 &lt;= prices.length &lt;= 500</code></li>
44-
<li><code>1 &lt;= prices[i] &lt;= 10^3</code></li>
46+
<li><code>1 &lt;= prices[i] &lt;= 1000</code></li>
4547
</ul>
4648

4749
## Solutions

solution/1500-1599/1518.Water Bottles/README.md

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,50 @@
1-
# [1518. 换酒问题](https://leetcode.cn/problems/water-bottles)
1+
# [1518. 换水问题](https://leetcode.cn/problems/water-bottles)
22

33
[English Version](/solution/1500-1599/1518.Water%20Bottles/README_EN.md)
44

55
## 题目描述
66

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

9-
<p>小区便利店正在促销,用 <code>numExchange</code> 个空酒瓶可以兑换一瓶新酒。你购入了 <code>numBottles</code> 瓶酒。</p>
9+
<p>超市正在促销,你可以用 <code>numExchange</code> 个空水瓶从超市兑换一瓶水。最开始,你一共购入了 <code>numBottles</code> 瓶水。</p>
1010

11-
<p>如果喝掉了酒瓶中的酒,那么酒瓶就会变成空的。</p>
11+
<p>如果喝掉了水瓶中的水,那么水瓶就会变成空的。</p>
1212

13-
<p>请你计算 <strong>最多</strong> 能喝到多少瓶酒。</p>
13+
<p>给你两个整数 <code>numBottles</code> 和 <code>numExchange</code> ,返回你 <strong>最多</strong> 可以喝到多少瓶水。</p>
1414

1515
<p>&nbsp;</p>
1616

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

19-
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1500-1599/1518.Water%20Bottles/images/sample_1_1875.png" style="height: 240px; width: 480px;"></strong></p>
19+
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1500-1599/1518.Water%20Bottles/images/sample_1_1875.png" style="height: 240px; width: 480px;" /></strong></p>
2020

21-
<pre><strong>输入:</strong>numBottles = 9, numExchange = 3
21+
<pre>
22+
<strong>输入:</strong>numBottles = 9, numExchange = 3
2223
<strong>输出:</strong>13
23-
<strong>解释:</strong>你可以用 <code>3</code> 个空酒瓶兑换 1 瓶酒
24-
所以最多能喝到 9 + 3 + 1 = 13 瓶酒
24+
<strong>解释:</strong>你可以用 <code>3</code> 个空瓶兑换 1 瓶水
25+
所以最多能喝到 9 + 3 + 1 = 13 瓶水
2526
</pre>
2627

2728
<p><strong>示例 2:</strong></p>
2829

29-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1500-1599/1518.Water%20Bottles/images/sample_2_1875.png" style="height: 240px; width: 790px;"></p>
30+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1500-1599/1518.Water%20Bottles/images/sample_2_1875.png" style="height: 240px; width: 790px;" /></p>
3031

31-
<pre><strong>输入:</strong>numBottles = 15, numExchange = 4
32+
<pre>
33+
<strong>输入:</strong>numBottles = 15, numExchange = 4
3234
<strong>输出:</strong>19
33-
<strong>解释:</strong>你可以用 <code>4</code> 个空酒瓶兑换 1 瓶酒
34-
所以最多能喝到 15 + 3 + 1 = 19 瓶酒
35+
<strong>解释:</strong>你可以用 <code>4</code> 个空瓶兑换 1 瓶水
36+
所以最多能喝到 15 + 3 + 1 = 19 瓶水
3537
</pre>
3638

37-
<p><strong>示例 3:</strong></p>
38-
39-
<pre><strong>输入:</strong>numBottles = 5, numExchange = 5
40-
<strong>输出:</strong>6
41-
</pre>
42-
43-
<p><strong>示例 4:</strong></p>
44-
45-
<pre><strong>输入:</strong>numBottles = 2, numExchange = 3
46-
<strong>输出:</strong>2
47-
</pre>
39+
<p>&nbsp;</p>
4840

4941
<p>&nbsp;</p>
5042

5143
<p><strong>提示:</strong></p>
5244

5345
<ul>
54-
<li><code>1 &lt;=&nbsp;numBottles &lt;= 100</code></li>
55-
<li><code>2 &lt;=&nbsp;numExchange &lt;= 100</code></li>
46+
<li><code>1 &lt;= numBottles &lt;= 100</code></li>
47+
<li><code>2 &lt;= numExchange &lt;= 100</code></li>
5648
</ul>
5749

5850
## 解法

solution/2400-2499/2412.Minimum Money Required Before Transactions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<b>输出:</b>3
3232
<strong>解释:</strong>
3333
- 如果交易执行的顺序是 [[3,0],[0,3]] ,完成所有交易需要的最少钱数是 3 。
34-
- 如果交易执行的顺序是 [[0,3],[3,0]] ,完成所有交易需要的最少钱数是 1
34+
- 如果交易执行的顺序是 [[0,3],[3,0]] ,完成所有交易需要的最少钱数是 0
3535
所以,刚开始钱数为 3 ,任意顺序下交易都可以全部完成。
3636
</pre>
3737

solution/2400-2499/2414.Length of the Longest Alphabetical Continuous Substring/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
利用双指针 $i$ 和 $j$,分别指向当前连续子字符串的起始位置和结束位置。遍历字符串 $s$,如果当前字符 $s[j]$ 比 $s[j-1]$ 大,则 $j$ 向右移动一位,否则更新 $i$ 为 $j$,并更新最长连续子字符串的长度。
5050

5151
时间复杂度 $O(n)$,空间复杂度 $O(1)$。其中 $n$ 为字符串 $s$ 的长度。
52+
5253
<!-- tabs:start -->
5354

5455
### **Python3**

0 commit comments

Comments
 (0)