Skip to content

Commit dd4898a

Browse files
authored
feat: update lc problems (#3502)
1 parent a4bfaa3 commit dd4898a

File tree

22 files changed

+112
-41
lines changed

22 files changed

+112
-41
lines changed

solution/1200-1299/1209.Remove All Adjacent Duplicates in String II/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tags:
3939

4040
<pre><strong>输入:</strong>s = &quot;deeedbbcccbdaa&quot;, k = 3
4141
<strong>输出:</strong>&quot;aa&quot;
42-
<strong>解释:
42+
<strong>解释:
4343
</strong>先删除 &quot;eee&quot;&quot;ccc&quot;,得到 &quot;ddbbbdaa&quot;
4444
再删除 &quot;bbb&quot;,得到 &quot;dddaa&quot;
4545
最后删除 &quot;ddd&quot;,得到 &quot;aa&quot;</pre>

solution/1200-1299/1209.Remove All Adjacent Duplicates in String II/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tags:
3838
<pre>
3939
<strong>Input:</strong> s = &quot;deeedbbcccbdaa&quot;, k = 3
4040
<strong>Output:</strong> &quot;aa&quot;
41-
<strong>Explanation:
41+
<strong>Explanation:
4242
</strong>First delete &quot;eee&quot; and &quot;ccc&quot;, get &quot;ddbbbdaa&quot;
4343
Then delete &quot;bbb&quot;, get &quot;dddaa&quot;
4444
Finally delete &quot;ddd&quot;, get &quot;aa&quot;</pre>

solution/1300-1399/1367.Linked List in Binary Tree/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ source: 第 178 场周赛 Q3
77
tags:
88
-
99
- 深度优先搜索
10-
- 广度优先搜索
1110
- 链表
1211
- 二叉树
1312
---

solution/1300-1399/1367.Linked List in Binary Tree/README_EN.md

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ source: Weekly Contest 178 Q3
77
tags:
88
- Tree
99
- Depth-First Search
10-
- Breadth-First Search
1110
- Linked List
1211
- Binary Tree
1312
---

solution/2100-2199/2181.Merge Nodes in Between Zeros/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tags:
3131
<pre>
3232
<strong>Input:</strong> head = [0,3,1,0,4,5,2,0]
3333
<strong>Output:</strong> [4,11]
34-
<strong>Explanation:</strong>
34+
<strong>Explanation:</strong>
3535
The above figure represents the given linked list. The modified list contains
3636
- The sum of the nodes marked in green: 3 + 1 = 4.
3737
- The sum of the nodes marked in red: 4 + 5 + 2 = 11.
@@ -42,7 +42,7 @@ The above figure represents the given linked list. The modified list contains
4242
<pre>
4343
<strong>Input:</strong> head = [0,1,0,3,0,2,2,0]
4444
<strong>Output:</strong> [1,3,4]
45-
<strong>Explanation:</strong>
45+
<strong>Explanation:</strong>
4646
The above figure represents the given linked list. The modified list contains
4747
- The sum of the nodes marked in green: 1 = 1.
4848
- The sum of the nodes marked in red: 3 = 3.

solution/2300-2399/2398.Maximum Number of Robots Within Budget/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tags:
3535
<pre>
3636
<strong>Input:</strong> chargeTimes = [3,6,1,3,4], runningCosts = [2,1,3,4,5], budget = 25
3737
<strong>Output:</strong> 3
38-
<strong>Explanation:</strong>
38+
<strong>Explanation:</strong>
3939
It is possible to run all individual and consecutive pairs of robots within budget.
4040
To obtain answer 3, consider the first 3 robots. The total cost will be max(3,6,1) + 3 * sum(2,1,3) = 6 + 3 * 6 = 24 which is less than 25.
4141
It can be shown that it is not possible to run more than 3 consecutive robots within budget, so we return 3.

solution/2400-2499/2472.Maximum Number of Non-overlapping Palindrome Substrings/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/2400-2499/2472.Ma
55
rating: 2013
66
source: 第 319 场周赛 Q4
77
tags:
8+
- 贪心
9+
- 双指针
810
- 字符串
911
- 动态规划
1012
---

solution/2400-2499/2472.Maximum Number of Non-overlapping Palindrome Substrings/README_EN.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/2400-2499/2472.Ma
55
rating: 2013
66
source: Weekly Contest 319 Q4
77
tags:
8+
- Greedy
9+
- Two Pointers
810
- String
911
- Dynamic Programming
1012
---

solution/2500-2599/2532.Time to Cross a Bridge/README_EN.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ tags:
4343
<ul>
4444
<li>Only one worker can use the bridge at a time.</li>
4545
<li>When the bridge is unused prioritize the <strong>least efficient</strong> worker on the right side to cross. If there are no workers on the right side, prioritize the <strong>least efficient</strong> worker on the left side to cross.</li>
46+
<li>If enough workers have already been dispatched from the left side to pick up all the remaining boxes, <strong>no more</strong> workers will be sent from the left side.</li>
4647
</ul>
4748

4849
<p>Return the <strong>elapsed minutes</strong> at which the last box reaches the <strong>left side of the bridge</strong>.</p>

solution/3000-3099/3038.Maximum Number of Operations With the Same Score I/README_EN.md

+38-20
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,56 @@ tags:
1919

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

22-
<p>Given an array of integers called <code>nums</code>, you can perform the following operation while <code>nums</code> contains <strong>at least</strong> <code>2</code> elements:</p>
22+
<p>You are given an array of integers <code>nums</code>. Consider the following operation:</p>
2323

2424
<ul>
25-
<li>Choose the first two elements of <code>nums</code> and delete them.</li>
25+
<li>Delete the first two elements <code>nums</code> and define the <em>score</em> of the operation as the sum of these two elements.</li>
2626
</ul>
2727

28-
<p>The<strong> score</strong> of the operation is the sum of the deleted elements.</p>
28+
<p>You can perform this operation until <code>nums</code> contains fewer than two elements. Additionally, the <strong>same</strong> <em>score</em> must be achieved in <strong>all</strong> operations.</p>
2929

30-
<p>Your task is to find the <strong>maximum</strong> number of operations that can be performed, such that <strong>all operations have the same score</strong>.</p>
31-
32-
<p>Return <em>the <strong>maximum</strong> number of operations possible that satisfy the condition mentioned above</em>.</p>
30+
<p>Return the <strong>maximum</strong> number of operations you can perform.</p>
3331

3432
<p>&nbsp;</p>
3533
<p><strong class="example">Example 1:</strong></p>
3634

37-
<pre>
38-
<strong>Input:</strong> nums = [3,2,1,4,5]
39-
<strong>Output:</strong> 2
40-
<strong>Explanation:</strong> We perform the following operations:
41-
- Delete the first two elements, with score 3 + 2 = 5, nums = [1,4,5].
42-
- Delete the first two elements, with score 1 + 4 = 5, nums = [5].
43-
We are unable to perform any more operations as nums contain only 1 element.</pre>
35+
<div class="example-block">
36+
<p><strong>Input:</strong> <span class="example-io">nums = [3,2,1,4,5]</span></p>
37+
38+
<p><strong>Output:</strong> <span class="example-io">2</span></p>
39+
40+
<p><strong>Explanation:</strong></p>
41+
42+
<ul>
43+
<li>We can perform the first operation with the score <code>3 + 2 = 5</code>. After this operation, <code>nums = [1,4,5]</code>.</li>
44+
<li>We can perform the second operation as its score is <code>4 + 1 = 5</code>, the same as the previous operation. After this operation, <code>nums = [5]</code>.</li>
45+
<li>As there are fewer than two elements, we can&#39;t perform more operations.</li>
46+
</ul>
47+
</div>
4448

4549
<p><strong class="example">Example 2:</strong></p>
4650

47-
<pre>
48-
<strong>Input:</strong> nums = [3,2,6,1,4]
49-
<strong>Output:</strong> 1
50-
<strong>Explanation:</strong> We perform the following operations:
51-
- Delete the first two elements, with score 3 + 2 = 5, nums = [6,1,4].
52-
We are unable to perform any more operations as the score of the next operation isn&#39;t the same as the previous one.
53-
</pre>
51+
<div class="example-block">
52+
<p><strong>Input:</strong> <span class="example-io">nums = [1,5,3,3,4,1,3,2,2,3]</span></p>
53+
54+
<p><strong>Output:</strong> <span class="example-io">1</span></p>
55+
56+
<p><strong>Explanation:</strong></p>
57+
58+
<ul>
59+
<li>We can perform the first operation with the score <code>1 + 5 = 6</code>. After this operation, <code>nums = [3,3,4,1,3,2,2,3]</code>.</li>
60+
<li>We can perform the second operation as its score is <code>3 + 3 = 6</code>, the same as the previous operation. After this operation, <code>nums = [4,1,3,2,2,3]</code>.</li>
61+
<li>We cannot perform the next operation as its score is <code>4 + 1 = 5</code>, which is different from the previous scores.</li>
62+
</ul>
63+
</div>
64+
65+
<p><strong class="example">Example 3:</strong></p>
66+
67+
<div class="example-block">
68+
<p><strong>Input:</strong> <span class="example-io">nums = [5,3]</span></p>
69+
70+
<p><strong>Output:</strong> <span class="example-io">1</span></p>
71+
</div>
5472

5573
<p>&nbsp;</p>
5674
<p><strong>Constraints:</strong></p>

solution/3200-3299/3279.Maximum Total Area Occupied by Pistons/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
comments: true
33
difficulty: 困难
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3279.Maximum%20Total%20Area%20Occupied%20by%20Pistons/README.md
5+
tags:
6+
- 数组
7+
- 哈希表
8+
- 字符串
9+
- 计数
10+
- 前缀和
11+
- 模拟
512
---
613

714
<!-- problem:start -->

solution/3200-3299/3279.Maximum Total Area Occupied by Pistons/README_EN.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
comments: true
33
difficulty: Hard
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3279.Maximum%20Total%20Area%20Occupied%20by%20Pistons/README_EN.md
5+
tags:
6+
- Array
7+
- Hash Table
8+
- String
9+
- Counting
10+
- Prefix Sum
11+
- Simulation
512
---
613

714
<!-- problem:start -->

solution/3200-3299/3280.Convert Date to Binary/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
comments: true
33
difficulty: 简单
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3280.Convert%20Date%20to%20Binary/README.md
5+
tags:
6+
- 数学
7+
- 字符串
58
---
69

710
<!-- problem:start -->

solution/3200-3299/3280.Convert Date to Binary/README_EN.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
comments: true
33
difficulty: Easy
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3280.Convert%20Date%20to%20Binary/README_EN.md
5+
tags:
6+
- Math
7+
- String
58
---
69

710
<!-- problem:start -->

solution/3200-3299/3281.Maximize Score of Numbers in Ranges/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README.md
5+
tags:
6+
- 贪心
7+
- 数组
8+
- 二分查找
9+
- 排序
510
---
611

712
<!-- problem:start -->

solution/3200-3299/3281.Maximize Score of Numbers in Ranges/README_EN.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README_EN.md
5+
tags:
6+
- Greedy
7+
- Array
8+
- Binary Search
9+
- Sorting
510
---
611

712
<!-- problem:start -->

solution/3200-3299/3282.Reach End of Array With Max Score/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README.md
5+
tags:
6+
- 贪心
7+
- 数组
58
---
69

710
<!-- problem:start -->

solution/3200-3299/3282.Reach End of Array With Max Score/README_EN.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README_EN.md
5+
tags:
6+
- Greedy
7+
- Array
58
---
69

710
<!-- problem:start -->

solution/3200-3299/3283.Maximum Number of Moves to Kill All Pawns/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
comments: true
33
difficulty: 困难
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README.md
5+
tags:
6+
- 位运算
7+
- 广度优先搜索
8+
- 数组
9+
- 数学
10+
- 状态压缩
11+
- 博弈
512
---
613

714
<!-- problem:start -->

solution/3200-3299/3283.Maximum Number of Moves to Kill All Pawns/README_EN.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
comments: true
33
difficulty: Hard
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README_EN.md
5+
tags:
6+
- Bit Manipulation
7+
- Breadth-First Search
8+
- Array
9+
- Math
10+
- Bitmask
11+
- Game Theory
512
---
613

714
<!-- problem:start -->

solution/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@
13771377
| 1364 | [顾客的可信联系人数量](/solution/1300-1399/1364.Number%20of%20Trusted%20Contacts%20of%20a%20Customer/README.md) | `数据库` | 中等 | 🔒 |
13781378
| 1365 | [有多少小于当前数字的数字](/solution/1300-1399/1365.How%20Many%20Numbers%20Are%20Smaller%20Than%20the%20Current%20Number/README.md) | `数组`,`哈希表`,`计数`,`排序` | 简单 | 第 178 场周赛 |
13791379
| 1366 | [通过投票对团队排名](/solution/1300-1399/1366.Rank%20Teams%20by%20Votes/README.md) | `数组`,`哈希表`,`字符串`,`计数`,`排序` | 中等 | 第 178 场周赛 |
1380-
| 1367 | [二叉树中的链表](/solution/1300-1399/1367.Linked%20List%20in%20Binary%20Tree/README.md) | `树`,`深度优先搜索`,`广度优先搜索`,`链表`,`二叉树` | 中等 | 第 178 场周赛 |
1380+
| 1367 | [二叉树中的链表](/solution/1300-1399/1367.Linked%20List%20in%20Binary%20Tree/README.md) | `树`,`深度优先搜索`,`链表`,`二叉树` | 中等 | 第 178 场周赛 |
13811381
| 1368 | [使网格图至少有一条有效路径的最小代价](/solution/1300-1399/1368.Minimum%20Cost%20to%20Make%20at%20Least%20One%20Valid%20Path%20in%20a%20Grid/README.md) | `广度优先搜索`,`图`,`数组`,`矩阵`,`最短路`,`堆(优先队列)` | 困难 | 第 178 场周赛 |
13821382
| 1369 | [获取最近第二次的活动](/solution/1300-1399/1369.Get%20the%20Second%20Most%20Recent%20Activity/README.md) | `数据库` | 困难 | 🔒 |
13831383
| 1370 | [上升下降字符串](/solution/1300-1399/1370.Increasing%20Decreasing%20String/README.md) | `哈希表`,`字符串`,`计数` | 简单 | 第 21 场双周赛 |
@@ -2482,7 +2482,7 @@
24822482
| 2469 | [温度转换](/solution/2400-2499/2469.Convert%20the%20Temperature/README.md) | `数学` | 简单 | 第 319 场周赛 |
24832483
| 2470 | [最小公倍数等于 K 的子数组数目](/solution/2400-2499/2470.Number%20of%20Subarrays%20With%20LCM%20Equal%20to%20K/README.md) | `数组`,`数学`,`数论` | 中等 | 第 319 场周赛 |
24842484
| 2471 | [逐层排序二叉树所需的最少操作数目](/solution/2400-2499/2471.Minimum%20Number%20of%20Operations%20to%20Sort%20a%20Binary%20Tree%20by%20Level/README.md) | `树`,`广度优先搜索`,`二叉树` | 中等 | 第 319 场周赛 |
2485-
| 2472 | [不重叠回文子字符串的最大数目](/solution/2400-2499/2472.Maximum%20Number%20of%20Non-overlapping%20Palindrome%20Substrings/README.md) | `字符串`,`动态规划` | 困难 | 第 319 场周赛 |
2485+
| 2472 | [不重叠回文子字符串的最大数目](/solution/2400-2499/2472.Maximum%20Number%20of%20Non-overlapping%20Palindrome%20Substrings/README.md) | `贪心`,`双指针`,`字符串`,`动态规划` | 困难 | 第 319 场周赛 |
24862486
| 2473 | [购买苹果的最低成本](/solution/2400-2499/2473.Minimum%20Cost%20to%20Buy%20Apples/README.md) | `图`,`数组`,`最短路`,`堆(优先队列)` | 中等 | 🔒 |
24872487
| 2474 | [购买量严格增加的客户](/solution/2400-2499/2474.Customers%20With%20Strictly%20Increasing%20Purchases/README.md) | `数据库` | 困难 | 🔒 |
24882488
| 2475 | [数组中不等三元组的数目](/solution/2400-2499/2475.Number%20of%20Unequal%20Triplets%20in%20Array/README.md) | `数组`,`哈希表`,`排序` | 简单 | 第 320 场周赛 |
@@ -3289,11 +3289,11 @@
32893289
| 3276 | [选择矩阵中单元格的最大得分](/solution/3200-3299/3276.Select%20Cells%20in%20Grid%20With%20Maximum%20Score/README.md) | `位运算`,`数组`,`动态规划`,`状态压缩`,`矩阵` | 困难 | 第 413 场周赛 |
32903290
| 3277 | [查询子数组最大异或值](/solution/3200-3299/3277.Maximum%20XOR%20Score%20Subarray%20Queries/README.md) | `数组`,`动态规划` | 困难 | 第 413 场周赛 |
32913291
| 3278 | [寻找数据科学家职位的候选人 II](/solution/3200-3299/3278.Find%20Candidates%20for%20Data%20Scientist%20Position%20II/README.md) | `数据库` | 中等 | 🔒 |
3292-
| 3279 | [Maximum Total Area Occupied by Pistons](/solution/3200-3299/3279.Maximum%20Total%20Area%20Occupied%20by%20Pistons/README.md) | | 困难 | 🔒 |
3293-
| 3280 | [将日期转换为二进制表示](/solution/3200-3299/3280.Convert%20Date%20to%20Binary/README.md) | | 简单 | 第 414 场周赛 |
3294-
| 3281 | [范围内整数的最大得分](/solution/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README.md) | | 中等 | 第 414 场周赛 |
3295-
| 3282 | [到达数组末尾的最大得分](/solution/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README.md) | | 中等 | 第 414 场周赛 |
3296-
| 3283 | [吃掉所有兵需要的最多移动次数](/solution/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README.md) | | 困难 | 第 414 场周赛 |
3292+
| 3279 | [Maximum Total Area Occupied by Pistons](/solution/3200-3299/3279.Maximum%20Total%20Area%20Occupied%20by%20Pistons/README.md) | `数组`,`哈希表`,`字符串`,`计数`,`前缀和`,`模拟` | 困难 | 🔒 |
3293+
| 3280 | [将日期转换为二进制表示](/solution/3200-3299/3280.Convert%20Date%20to%20Binary/README.md) | `数学`,`字符串` | 简单 | 第 414 场周赛 |
3294+
| 3281 | [范围内整数的最大得分](/solution/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README.md) | `贪心`,`数组`,`二分查找`,`排序` | 中等 | 第 414 场周赛 |
3295+
| 3282 | [到达数组末尾的最大得分](/solution/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README.md) | `贪心`,`数组` | 中等 | 第 414 场周赛 |
3296+
| 3283 | [吃掉所有兵需要的最多移动次数](/solution/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README.md) | `位运算`,`广度优先搜索`,`数组`,`数学`,`状态压缩`,`博弈` | 困难 | 第 414 场周赛 |
32973297

32983298
## 版权
32993299

0 commit comments

Comments
 (0)