Skip to content

Commit dd4898a

Browse files
authored
feat: update lc problems (doocs#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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 38 additions & 20 deletions
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>

0 commit comments

Comments
 (0)