Skip to content

Commit ff8d611

Browse files
committed
chore: update lc problems
1 parent 2dcc707 commit ff8d611

File tree

25 files changed

+337
-23
lines changed

25 files changed

+337
-23
lines changed

solution/3400-3499/3482.Analyze Organization Hierarchy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ employee_id 是这张表的唯一主键。
135135

136136
<ul>
137137
<li>结果先以层级升序排序</li>
138-
<li>在同一层级内,员工按预算降序排序,然后按姓名降序排序</li>
138+
<li>在同一层级内,员工按预算降序排序,然后按姓名升序排序</li>
139139
</ul>
140140
</div>
141141

solution/3400-3499/3496.Maximize Score After Pair Deletions/README.md

Lines changed: 3 additions & 0 deletions
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/3400-3499/3496.Maximize%20Score%20After%20Pair%20Deletions/README.md
5+
tags:
6+
- 贪心
7+
- 数组
58
---
69

710
<!-- problem:start -->

solution/3400-3499/3496.Maximize Score After Pair Deletions/README_EN.md

Lines changed: 3 additions & 0 deletions
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/3400-3499/3496.Maximize%20Score%20After%20Pair%20Deletions/README_EN.md
5+
tags:
6+
- Greedy
7+
- Array
58
---
69

710
<!-- problem:start -->

solution/3400-3499/3498.Reverse Degree of a String/README.md

Lines changed: 3 additions & 0 deletions
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/3400-3499/3498.Reverse%20Degree%20of%20a%20String/README.md
5+
tags:
6+
- 字符串
7+
- 模拟
58
---
69

710
<!-- problem:start -->

solution/3400-3499/3498.Reverse Degree of a String/README_EN.md

Lines changed: 3 additions & 0 deletions
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/3400-3499/3498.Reverse%20Degree%20of%20a%20String/README_EN.md
5+
tags:
6+
- String
7+
- Simulation
58
---
69

710
<!-- problem:start -->

solution/3400-3499/3499.Maximize Active Section with Trade I/README.md

Lines changed: 3 additions & 0 deletions
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/3400-3499/3499.Maximize%20Active%20Section%20with%20Trade%20I/README.md
5+
tags:
6+
- 字符串
7+
- 枚举
58
---
69

710
<!-- problem:start -->

solution/3400-3499/3499.Maximize Active Section with Trade I/README_EN.md

Lines changed: 3 additions & 0 deletions
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/3400-3499/3499.Maximize%20Active%20Section%20with%20Trade%20I/README_EN.md
5+
tags:
6+
- String
7+
- Enumeration
58
---
69

710
<!-- problem:start -->

solution/3500-3599/3500.Minimum Cost to Divide Array Into Subarrays/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
comments: true
33
difficulty: 困难
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3500.Minimum%20Cost%20to%20Divide%20Array%20Into%20Subarrays/README.md
5+
tags:
6+
- 数组
7+
- 动态规划
8+
- 前缀和
59
---
610

711
<!-- problem:start -->

solution/3500-3599/3500.Minimum Cost to Divide Array Into Subarrays/README_EN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
comments: true
33
difficulty: Hard
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3500.Minimum%20Cost%20to%20Divide%20Array%20Into%20Subarrays/README_EN.md
5+
tags:
6+
- Array
7+
- Dynamic Programming
8+
- Prefix Sum
59
---
610

711
<!-- problem:start -->

solution/3500-3599/3501.Maximize Active Section with Trade II/README.md

Lines changed: 5 additions & 0 deletions
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/3500-3599/3501.Maximize%20Active%20Section%20with%20Trade%20II/README.md
5+
tags:
6+
- 线段树
7+
- 数组
8+
- 字符串
9+
- 二分查找
510
---
611

712
<!-- problem:start -->

solution/3500-3599/3501.Maximize Active Section with Trade II/README_EN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
comments: true
33
difficulty: Hard
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3501.Maximize%20Active%20Section%20with%20Trade%20II/README_EN.md
5+
tags:
6+
- Segment Tree
7+
- Array
8+
- String
9+
- Binary Search
510
---
611

712
<!-- problem:start -->

solution/3500-3599/3502.Minimum Cost to Reach Every Position/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 简单
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3502.Minimum%20Cost%20to%20Reach%20Every%20Position/README.md
5+
tags:
6+
- 数组
57
---
68

79
<!-- problem:start -->

solution/3500-3599/3502.Minimum Cost to Reach Every Position/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: Easy
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3502.Minimum%20Cost%20to%20Reach%20Every%20Position/README_EN.md
5+
tags:
6+
- Array
57
---
68

79
<!-- problem:start -->

solution/3500-3599/3503.Longest Palindrome After Substring Concatenation I/README.md

Lines changed: 5 additions & 0 deletions
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/3500-3599/3503.Longest%20Palindrome%20After%20Substring%20Concatenation%20I/README.md
5+
tags:
6+
- 双指针
7+
- 字符串
8+
- 动态规划
9+
- 枚举
510
---
611

712
<!-- problem:start -->

solution/3500-3599/3503.Longest Palindrome After Substring Concatenation I/README_EN.md

Lines changed: 5 additions & 0 deletions
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/3500-3599/3503.Longest%20Palindrome%20After%20Substring%20Concatenation%20I/README_EN.md
5+
tags:
6+
- Two Pointers
7+
- String
8+
- Dynamic Programming
9+
- Enumeration
510
---
611

712
<!-- problem:start -->

solution/3500-3599/3504.Longest Palindrome After Substring Concatenation II/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
comments: true
33
difficulty: 困难
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3504.Longest%20Palindrome%20After%20Substring%20Concatenation%20II/README.md
5+
tags:
6+
- 双指针
7+
- 字符串
8+
- 动态规划
59
---
610

711
<!-- problem:start -->

solution/3500-3599/3504.Longest Palindrome After Substring Concatenation II/README_EN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
comments: true
33
difficulty: Hard
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3504.Longest%20Palindrome%20After%20Substring%20Concatenation%20II/README_EN.md
5+
tags:
6+
- Two Pointers
7+
- String
8+
- Dynamic Programming
59
---
610

711
<!-- problem:start -->

solution/3500-3599/3505.Minimum Operations to Make Elements Within K Subarrays Equal/README.md

Lines changed: 7 additions & 0 deletions
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/3500-3599/3505.Minimum%20Operations%20to%20Make%20Elements%20Within%20K%20Subarrays%20Equal/README.md
5+
tags:
6+
- 数组
7+
- 哈希表
8+
- 数学
9+
- 动态规划
10+
- 滑动窗口
11+
- 堆(优先队列)
512
---
613

714
<!-- problem:start -->

solution/3500-3599/3505.Minimum Operations to Make Elements Within K Subarrays Equal/README_EN.md

Lines changed: 7 additions & 0 deletions
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/3500-3599/3505.Minimum%20Operations%20to%20Make%20Elements%20Within%20K%20Subarrays%20Equal/README_EN.md
5+
tags:
6+
- Array
7+
- Hash Table
8+
- Math
9+
- Dynamic Programming
10+
- Sliding Window
11+
- Heap (Priority Queue)
512
---
613

714
<!-- problem:start -->
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
comments: true
3+
difficulty: 困难
4+
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains/README.md
5+
---
6+
7+
<!-- problem:start -->
8+
9+
# [3506. 查找消除细菌菌株所需时间 II 🔒](https://leetcode.cn/problems/find-time-required-to-eliminate-bacterial-strains)
10+
11+
[English Version](/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains/README_EN.md)
12+
13+
## 题目描述
14+
15+
<!-- description:start -->
16+
17+
<p>给定一个整数数组&nbsp;<code>timeReq</code>&nbsp;和一个整数&nbsp;<code>splitTime</code>。</p>
18+
19+
<p>在人体微观世界中,免疫系统面临着一项非凡的挑战:对抗快速繁殖的细菌群落,这对身体的生存构成威胁。</p>
20+
21+
<p>最初,只部署一个 <strong>白细胞</strong>(<strong>WBC</strong>)来消除细菌。然而,单独的白细胞很快意识到它无法跟上细菌的生长速度。</p>
22+
23+
<p>WBC制定了一种巧妙的策略来对抗细菌:</p>
24+
25+
<ul>
26+
<li>第 <code>i</code> 个细菌菌株需要 <code>timeReq[i]</code> 个时间单位来被消除。</li>
27+
<li>单个白细胞只能消除 <strong>一种</strong> 细菌菌株。之后,白细胞耗尽,无法执行任何其他任务。</li>
28+
<li>一个白细胞可以将自身分裂为两个白细胞,但这需要&nbsp;<code>splitTime</code>&nbsp;单位时间。一旦分裂,两个白细胞就可以 <strong>并行</strong> 消灭细菌。</li>
29+
<li>仅有一个白细胞可以针对一个单一细菌菌株工作。多个白细胞不能同时攻击一个菌株。</li>
30+
</ul>
31+
32+
<p>您必须确定消除所有细菌菌株所需的 <strong>最短</strong> 时间。</p>
33+
34+
<p><strong>注意</strong>,细菌菌株可以按任何顺序消除。</p>
35+
36+
<p>&nbsp;</p>
37+
38+
<p><strong class="example">示例 1:</strong></p>
39+
40+
<div class="example-block">
41+
<p><span class="example-io"><b>输入:</b>timeReq = [10,4,5], splitTime = 2</span></p>
42+
43+
<p><span class="example-io"><b>输出:</b>12</span></p>
44+
45+
<p><b>解释:</b></p>
46+
47+
<p>消除过程如下:</p>
48+
49+
<ul>
50+
<li>最初,有一个白细胞。经过 2 个时间单位后,白细胞分裂成 2 个白细胞。</li>
51+
<li>其中一个白细胞在&nbsp;<code>t = 2 + 10 = 12</code>&nbsp;时间内消除菌株 0。另一个白细胞使用 2 个单位时间再次分裂。</li>
52+
<li>2 个新的白细胞消灭细菌的时间是 <code>t = 2 + 2 + 4</code> 和&nbsp;<code>t = 2 + 2 + 5</code>。</li>
53+
</ul>
54+
</div>
55+
56+
<p><strong class="example">示例 2:</strong></p>
57+
58+
<div class="example-block">
59+
<p><span class="example-io"><b>输入:</b>timeReq = [10,4], splitTime = 5</span></p>
60+
61+
<p><b>输出:</b>5</p>
62+
63+
<p><strong>解释:</strong></p>
64+
65+
<p>消除过程如下:</p>
66+
67+
<ul>
68+
<li>最初,有一个白细胞。经过 5 个时间单位后,白细胞分裂成 2 个白细胞。</li>
69+
<li>2 个新的白细胞消灭细菌的时间是&nbsp;<code>t = 5 + 10</code> 和&nbsp;<code>t = 5 + 4</code>。</li>
70+
</ul>
71+
</div>
72+
73+
<p>&nbsp;</p>
74+
75+
<p><strong>提示:</strong></p>
76+
77+
<ul>
78+
<li><code>2 &lt;= timeReq.length &lt;= 10<sup>5</sup></code></li>
79+
<li><code>1 &lt;= timeReq[i] &lt;= 10<sup>9</sup></code></li>
80+
<li><code>1 &lt;= splitTime &lt;= 10<sup>9</sup></code></li>
81+
</ul>
82+
83+
<!-- description:end -->
84+
85+
## 解法
86+
87+
<!-- solution:start -->
88+
89+
### 方法一
90+
91+
<!-- tabs:start -->
92+
93+
#### Python3
94+
95+
```python
96+
97+
```
98+
99+
#### Java
100+
101+
```java
102+
103+
```
104+
105+
#### C++
106+
107+
```cpp
108+
109+
```
110+
111+
#### Go
112+
113+
```go
114+
115+
```
116+
117+
<!-- tabs:end -->
118+
119+
<!-- solution:end -->
120+
121+
<!-- problem:end -->

0 commit comments

Comments
 (0)