Skip to content

chore: update lc problems #4319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ employee_id 是这张表的唯一主键。

<ul>
<li>结果先以层级升序排序</li>
<li>在同一层级内,员工按预算降序排序,然后按姓名降序排序</li>
<li>在同一层级内,员工按预算降序排序,然后按姓名升序排序</li>
</ul>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3496.Maximize%20Score%20After%20Pair%20Deletions/README.md
tags:
- 贪心
- 数组
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3496.Maximize%20Score%20After%20Pair%20Deletions/README_EN.md
tags:
- Greedy
- Array
---

<!-- problem:start -->
Expand Down
3 changes: 3 additions & 0 deletions solution/3400-3499/3498.Reverse Degree of a String/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3498.Reverse%20Degree%20of%20a%20String/README.md
tags:
- 字符串
- 模拟
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3498.Reverse%20Degree%20of%20a%20String/README_EN.md
tags:
- String
- Simulation
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3499.Maximize%20Active%20Section%20with%20Trade%20I/README.md
tags:
- 字符串
- 枚举
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3499.Maximize%20Active%20Section%20with%20Trade%20I/README_EN.md
tags:
- String
- Enumeration
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3500.Minimum%20Cost%20to%20Divide%20Array%20Into%20Subarrays/README.md
tags:
- 数组
- 动态规划
- 前缀和
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3500.Minimum%20Cost%20to%20Divide%20Array%20Into%20Subarrays/README_EN.md
tags:
- Array
- Dynamic Programming
- Prefix Sum
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3501.Maximize%20Active%20Section%20with%20Trade%20II/README.md
tags:
- 线段树
- 数组
- 字符串
- 二分查找
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3501.Maximize%20Active%20Section%20with%20Trade%20II/README_EN.md
tags:
- Segment Tree
- Array
- String
- Binary Search
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3502.Minimum%20Cost%20to%20Reach%20Every%20Position/README.md
tags:
- 数组
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3502.Minimum%20Cost%20to%20Reach%20Every%20Position/README_EN.md
tags:
- Array
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3503.Longest%20Palindrome%20After%20Substring%20Concatenation%20I/README.md
tags:
- 双指针
- 字符串
- 动态规划
- 枚举
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3503.Longest%20Palindrome%20After%20Substring%20Concatenation%20I/README_EN.md
tags:
- Two Pointers
- String
- Dynamic Programming
- Enumeration
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3504.Longest%20Palindrome%20After%20Substring%20Concatenation%20II/README.md
tags:
- 双指针
- 字符串
- 动态规划
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3504.Longest%20Palindrome%20After%20Substring%20Concatenation%20II/README_EN.md
tags:
- Two Pointers
- String
- Dynamic Programming
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3505.Minimum%20Operations%20to%20Make%20Elements%20Within%20K%20Subarrays%20Equal/README.md
tags:
- 数组
- 哈希表
- 数学
- 动态规划
- 滑动窗口
- 堆(优先队列)
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
comments: true
difficulty: Hard
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
tags:
- Array
- Hash Table
- Math
- Dynamic Programming
- Sliding Window
- Heap (Priority Queue)
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,76 +1,78 @@
---
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains%20II/README.md
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains/README.md
---

<!-- problem:start -->

# [3506. Find Time Required to Eliminate Bacterial Strains II 🔒](https://leetcode.cn/problems/find-time-required-to-eliminate-bacterial-strains-ii)
# [3506. 查找消除细菌菌株所需时间 II 🔒](https://leetcode.cn/problems/find-time-required-to-eliminate-bacterial-strains)

[English Version](/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains%20II/README_EN.md)
[English Version](/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains/README_EN.md)

## 题目描述

<!-- description:start -->

<p>You are given an integer array <code>timeReq</code> and an integer <code>splitTime</code>.</p>
<p>给定一个整数数组&nbsp;<code>timeReq</code>&nbsp;和一个整数&nbsp;<code>splitTime</code></p>

<p>In the microscopic world of the human body, the immune system faces an extraordinary challenge: combatting a rapidly multiplying bacterial colony that threatens the body&#39;s survival.</p>
<p>在人体微观世界中,免疫系统面临着一项非凡的挑战:对抗快速繁殖的细菌群落,这对身体的生存构成威胁。</p>

<p>Initially, only one <strong>white blood cell</strong> (<strong>WBC</strong>) is deployed to eliminate the bacteria. However, the lone WBC quickly realizes it cannot keep up with the bacterial growth rate.</p>
<p>最初,只部署一个 <strong>白细胞</strong><strong>WBC</strong>)来消除细菌。然而,单独的白细胞很快意识到它无法跟上细菌的生长速度。</p>

<p>The WBC devises a clever strategy to fight the bacteria:</p>
<p>WBC制定了一种巧妙的策略来对抗细菌:</p>

<ul>
<li>The <code>i<sup>th</sup></code> bacterial strain takes <code>timeReq[i]</code> units of time to be eliminated.</li>
<li>A single WBC can eliminate <strong>only one</strong> bacterial strain. Afterwards, the WBC is exhausted and cannot perform any other tasks.</li>
<li>A WBC can split itself into two WBCs, but this requires <code>splitTime</code> units of time. Once split, the two WBCs can work in <strong>parallel</strong> on eliminating the bacteria.</li>
<li><em>Only one</em> WBC can work on a single bacterial strain. Multiple WBCs <strong>cannot</strong> attack one strain in parallel.</li>
<li> <code>i</code> 个细菌菌株需要 <code>timeReq[i]</code> 个时间单位来被消除。</li>
<li>单个白细胞只能消除 <strong>一种</strong> 细菌菌株。之后,白细胞耗尽,无法执行任何其他任务。</li>
<li>一个白细胞可以将自身分裂为两个白细胞,但这需要&nbsp;<code>splitTime</code>&nbsp;单位时间。一旦分裂,两个白细胞就可以 <strong>并行</strong> 消灭细菌。</li>
<li>仅有一个白细胞可以针对一个单一细菌菌株工作。多个白细胞不能同时攻击一个菌株。</li>
</ul>

<p>You must determine the <strong>minimum</strong> time required to eliminate all the bacterial strains.</p>
<p>您必须确定消除所有细菌菌株所需的 <strong>最短</strong> 时间。</p>

<p><strong>Note</strong> that the bacterial strains can be eliminated in any order.</p>
<p><strong>注意</strong>,细菌菌株可以按任何顺序消除。</p>

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

<p><strong class="example">示例 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">timeReq = [10,4,5], splitTime = 2</span></p>
<p><span class="example-io"><b>输入:</b>timeReq = [10,4,5], splitTime = 2</span></p>

<p><strong>Output:</strong> <span class="example-io">12</span></p>
<p><span class="example-io"><b>输出:</b>12</span></p>

<p><strong>Explanation:</strong></p>
<p><b>解释:</b></p>

<p>The elimination process goes as follows:</p>
<p>消除过程如下:</p>

<ul>
<li>Initially, there is a single WBC. The WBC splits into 2 WBCs after 2 units of time.</li>
<li>One of the WBCs eliminates strain 0 at a time <code>t = 2 + 10 = 12.</code> The other WBC splits again, using 2 units of time.</li>
<li>The 2 new WBCs eliminate the bacteria at times <code>t = 2 + 2 + 4</code> and <code>t = 2 + 2 + 5</code>.</li>
<li>最初,有一个白细胞。经过 2 个时间单位后,白细胞分裂成 2 个白细胞。</li>
<li>其中一个白细胞在&nbsp;<code>t = 2 + 10 = 12</code>&nbsp;时间内消除菌株 0。另一个白细胞使用 2 个单位时间再次分裂。</li>
<li>2 个新的白细胞消灭细菌的时间是 <code>t = 2 + 2 + 4</code> 和&nbsp;<code>t = 2 + 2 + 5</code></li>
</ul>
</div>

<p><strong class="example">Example 2:</strong></p>
<p><strong class="example">示例 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">timeReq = [10,4], splitTime = 5</span></p>
<p><span class="example-io"><b>输入:</b>timeReq = [10,4], splitTime = 5</span></p>

<p><strong>Output:</strong>15</p>
<p><b>输出:</b>5</p>

<p><strong>Explanation:</strong></p>
<p><strong>解释:</strong></p>

<p>The elimination process goes as follows:</p>
<p>消除过程如下:</p>

<ul>
<li>Initially, there is a single WBC. The WBC splits into 2 WBCs after 5 units of time.</li>
<li>The 2 new WBCs eliminate the bacteria at times <code>t = 5 + 10</code> and <code>t = 5 + 4</code>.</li>
<li>最初,有一个白细胞。经过 5 个时间单位后,白细胞分裂成 2 个白细胞。</li>
<li>2 个新的白细胞消灭细菌的时间是&nbsp;<code>t = 5 + 10</code> 和&nbsp;<code>t = 5 + 4</code></li>
</ul>
</div>

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

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

<ul>
<li><code>2 &lt;= timeReq.length &lt;= 10<sup>5</sup></code></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains%20II/README_EN.md
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains/README_EN.md
---

<!-- problem:start -->

# [3506. Find Time Required to Eliminate Bacterial Strains II 🔒](https://leetcode.com/problems/find-time-required-to-eliminate-bacterial-strains-ii)
# [3506. Find Time Required to Eliminate Bacterial Strains 🔒](https://leetcode.com/problems/find-time-required-to-eliminate-bacterial-strains)

[中文文档](/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains%20II/README.md)
[中文文档](/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains/README.md)

## Description

Expand Down
2 changes: 1 addition & 1 deletion solution/DATABASE_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
| 3465 | [查找具有有效序列号的产品](/solution/3400-3499/3465.Find%20Products%20with%20Valid%20Serial%20Numbers/README.md) | `数据库` | 简单 | |
| 3475 | [DNA 模式识别](/solution/3400-3499/3475.DNA%20Pattern%20Recognition/README.md) | | 中等 | |
| 3482 | [分析组织层级](/solution/3400-3499/3482.Analyze%20Organization%20Hierarchy/README.md) | `数据库` | 困难 | |
| 3497 | [分析订阅转化](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README.md) | | 中等 | |
| 3497 | [分析订阅转化](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README.md) | `数据库` | 中等 | |

## 版权

Expand Down
2 changes: 1 addition & 1 deletion solution/DATABASE_README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Press <kbd>Control</kbd> + <kbd>F</kbd>(or <kbd>Command</kbd> + <kbd>F</kbd> on
| 3465 | [Find Products with Valid Serial Numbers](/solution/3400-3499/3465.Find%20Products%20with%20Valid%20Serial%20Numbers/README_EN.md) | `Database` | Easy | |
| 3475 | [DNA Pattern Recognition](/solution/3400-3499/3475.DNA%20Pattern%20Recognition/README_EN.md) | | Medium | |
| 3482 | [Analyze Organization Hierarchy](/solution/3400-3499/3482.Analyze%20Organization%20Hierarchy/README_EN.md) | `Database` | Hard | |
| 3497 | [Analyze Subscription Conversion](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README_EN.md) | | Medium | |
| 3497 | [Analyze Subscription Conversion](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README_EN.md) | `Database` | Medium | |

## Copyright

Expand Down
22 changes: 11 additions & 11 deletions solution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3506,17 +3506,17 @@
| 3493 | [属性图](/solution/3400-3499/3493.Properties%20Graph/README.md) | `深度优先搜索`,`广度优先搜索`,`并查集`,`图`,`数组`,`哈希表` | 中等 | 第 442 场周赛 |
| 3494 | [酿造药水需要的最少总时间](/solution/3400-3499/3494.Find%20the%20Minimum%20Amount%20of%20Time%20to%20Brew%20Potions/README.md) | `数组`,`前缀和`,`模拟` | 中等 | 第 442 场周赛 |
| 3495 | [使数组元素都变为零的最少操作次数](/solution/3400-3499/3495.Minimum%20Operations%20to%20Make%20Array%20Elements%20Zero/README.md) | `位运算`,`数组`,`数学` | 困难 | 第 442 场周赛 |
| 3496 | [最大化配对删除后的得分](/solution/3400-3499/3496.Maximize%20Score%20After%20Pair%20Deletions/README.md) | | 中等 | 🔒 |
| 3497 | [分析订阅转化](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README.md) | | 中等 | |
| 3498 | [字符串的反转度](/solution/3400-3499/3498.Reverse%20Degree%20of%20a%20String/README.md) | | 简单 | 第 153 场双周赛 |
| 3499 | [操作后最大活跃区段数 I](/solution/3400-3499/3499.Maximize%20Active%20Section%20with%20Trade%20I/README.md) | | 中等 | 第 153 场双周赛 |
| 3500 | [将数组分割为子数组的最小代价](/solution/3500-3599/3500.Minimum%20Cost%20to%20Divide%20Array%20Into%20Subarrays/README.md) | | 困难 | 第 153 场双周赛 |
| 3501 | [操作后最大活跃区段数 II](/solution/3500-3599/3501.Maximize%20Active%20Section%20with%20Trade%20II/README.md) | | 困难 | 第 153 场双周赛 |
| 3502 | [到达每个位置的最小费用](/solution/3500-3599/3502.Minimum%20Cost%20to%20Reach%20Every%20Position/README.md) | | 简单 | 第 443 场周赛 |
| 3503 | [子字符串连接后的最长回文串 I](/solution/3500-3599/3503.Longest%20Palindrome%20After%20Substring%20Concatenation%20I/README.md) | | 中等 | 第 443 场周赛 |
| 3504 | [子字符串连接后的最长回文串 II](/solution/3500-3599/3504.Longest%20Palindrome%20After%20Substring%20Concatenation%20II/README.md) | | 困难 | 第 443 场周赛 |
| 3505 | [使 K 个子数组内元素相等的最少操作数](/solution/3500-3599/3505.Minimum%20Operations%20to%20Make%20Elements%20Within%20K%20Subarrays%20Equal/README.md) | | 困难 | 第 443 场周赛 |
| 3506 | [Find Time Required to Eliminate Bacterial Strains II](/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains%20II/README.md) | | 困难 | 🔒 |
| 3496 | [最大化配对删除后的得分](/solution/3400-3499/3496.Maximize%20Score%20After%20Pair%20Deletions/README.md) | `贪心`,`数组` | 中等 | 🔒 |
| 3497 | [分析订阅转化](/solution/3400-3499/3497.Analyze%20Subscription%20Conversion/README.md) | `数据库` | 中等 | |
| 3498 | [字符串的反转度](/solution/3400-3499/3498.Reverse%20Degree%20of%20a%20String/README.md) | `字符串`,`模拟` | 简单 | 第 153 场双周赛 |
| 3499 | [操作后最大活跃区段数 I](/solution/3400-3499/3499.Maximize%20Active%20Section%20with%20Trade%20I/README.md) | `字符串`,`枚举` | 中等 | 第 153 场双周赛 |
| 3500 | [将数组分割为子数组的最小代价](/solution/3500-3599/3500.Minimum%20Cost%20to%20Divide%20Array%20Into%20Subarrays/README.md) | `数组`,`动态规划`,`前缀和` | 困难 | 第 153 场双周赛 |
| 3501 | [操作后最大活跃区段数 II](/solution/3500-3599/3501.Maximize%20Active%20Section%20with%20Trade%20II/README.md) | `线段树`,`数组`,`字符串`,`二分查找` | 困难 | 第 153 场双周赛 |
| 3502 | [到达每个位置的最小费用](/solution/3500-3599/3502.Minimum%20Cost%20to%20Reach%20Every%20Position/README.md) | `数组` | 简单 | 第 443 场周赛 |
| 3503 | [子字符串连接后的最长回文串 I](/solution/3500-3599/3503.Longest%20Palindrome%20After%20Substring%20Concatenation%20I/README.md) | `双指针`,`字符串`,`动态规划`,`枚举` | 中等 | 第 443 场周赛 |
| 3504 | [子字符串连接后的最长回文串 II](/solution/3500-3599/3504.Longest%20Palindrome%20After%20Substring%20Concatenation%20II/README.md) | `双指针`,`字符串`,`动态规划` | 困难 | 第 443 场周赛 |
| 3505 | [使 K 个子数组内元素相等的最少操作数](/solution/3500-3599/3505.Minimum%20Operations%20to%20Make%20Elements%20Within%20K%20Subarrays%20Equal/README.md) | `数组`,`哈希表`,`数学`,`动态规划`,`滑动窗口`,`堆(优先队列)` | 困难 | 第 443 场周赛 |
| 3506 | [查找消除细菌菌株所需时间 II](/solution/3500-3599/3506.Find%20Time%20Required%20to%20Eliminate%20Bacterial%20Strains/README.md) | | 困难 | 🔒 |

## 版权

Expand Down
Loading
Loading