Skip to content
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

feat: update lc problems #4128

Merged
merged 1 commit into from
Mar 5, 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
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,18 @@ https://doocs.github.io/leetcode
1. 将你的变更以 PR 的形式提交过来,项目的维护人员会在第一时间对你的变更进行 review!
1. 你也可以参考帮助文档 https://help.github.com/cn 了解更多细节。

<p align="center">
  <a href="https://github.com/doocs/leetcode"><img src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/leetcode@main/images/how-to-contribute.svg" alt="how-to-contribute"></a>
</p>
<div align="center">

```mermaid
graph TD;
A[LeetCode 仓库 <br> doocs/leetcode.git] -- 1.Fork(派生) --> B[你的 GitHub 仓库 <br> yourusername/leetcode.git];
B -- 2.Git 克隆 --> C[本地开发环境];
C -- 3.创建新分支并修改代码 --> D[本地修改后的代码];
D -- 4.提交 & 推送到你的仓库 --> B;
B -- 5.提交 Pull Request(合并请求) --> A;
```

</div>

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=149001365&machine=basicLinux32gb&location=SoutheastAsia)

Expand Down
15 changes: 12 additions & 3 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,18 @@ I'm looking for long-term contributors/partners to this repo! Send me [PRs](http
1. Create a pull request with your changes!
1. See [CONTRIBUTING](https://github.com/doocs/.github/blob/main/CONTRIBUTING.md) or [GitHub Help](https://help.github.com/en) for more details.

<p align="center">
  <a href="https://github.com/doocs/leetcode"><img src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/leetcode@main/images/how-to-contribute.svg" alt="how-to-contribute"></a>
</p>
<div align="center">

```mermaid
graph TD;
A[LeetCode Repo <br> doocs/leetcode.git] -- 1.Fork --> B[Your GitHub Repo <br> yourusername/leetcode.git];
B -- 2.Git Clone --> C[Local Machine];
C -- 3.Create a New Branch & Make Changes --> D[Modify Code Locally];
D -- 4.Commit & Push to Your Repo --> B;
B -- 5.Create a Pull Request --> A;
```

</div>

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=149001365&machine=basicLinux32gb&location=EastUs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tags:
<pre>
<strong>Input:</strong> nums = [9,12,5,10,14,3,10], pivot = 10
<strong>Output:</strong> [9,5,3,10,10,12,14]
<strong>Explanation:</strong>
<strong>Explanation:</strong>
The elements 9, 5, and 3 are less than the pivot so they are on the left side of the array.
The elements 12 and 14 are greater than the pivot so they are on the right side of the array.
The relative ordering of the elements less than and greater than pivot is also maintained. [9, 5, 3] and [12, 14] are the respective orderings.
Expand All @@ -51,7 +51,7 @@ The relative ordering of the elements less than and greater than pivot is also m
<pre>
<strong>Input:</strong> nums = [-3,4,3,2], pivot = 2
<strong>Output:</strong> [-3,2,4,3]
<strong>Explanation:</strong>
<strong>Explanation:</strong>
The element -3 is less than the pivot so it is on the left side of the array.
The elements 4 and 3 are greater than the pivot so they are on the right side of the array.
The relative ordering of the elements less than and greater than pivot is also maintained. [-3] and [4, 3] are the respective orderings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,71 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3476.Ma

<!-- problem:start -->

# [3476. Maximize Profit from Task Assignment 🔒](https://leetcode.cn/problems/maximize-profit-from-task-assignment)
# [3476. 最大化任务分配的利润 🔒](https://leetcode.cn/problems/maximize-profit-from-task-assignment)

[English Version](/solution/3400-3499/3476.Maximize%20Profit%20from%20Task%20Assignment/README_EN.md)

## 题目描述

<!-- description:start -->

<p>You are given an integer array <code>workers</code>, where <code>workers[i]</code> represents the skill level of the <code>i<sup>th</sup></code> worker. You are also given a 2D integer array <code>tasks</code>, where:</p>
<p>给定一个整数数组&nbsp;<code>workers</code>,其中&nbsp;<code>workers[i]</code>&nbsp;表示第&nbsp;<code>i</code>&nbsp;个工人的技能等级。同时给定一个 2 维数组&nbsp;<code>tasks</code>,其中:</p>

<ul>
<li><code>tasks[i][0]</code> represents the skill requirement needed to complete the task.</li>
<li><code>tasks[i][1]</code> represents the profit earned from completing the task.</li>
<li><code>tasks[i][0]</code>&nbsp;表示完成任务所需的技能要求。</li>
<li><code>tasks[i][1]</code>&nbsp;表示完成任务的收益。</li>
</ul>

<p>Each worker can complete <strong>at most</strong> one task, and they can only take a task if their skill level is <strong>equal</strong> to the task&#39;s skill requirement. An <strong>additional</strong> worker joins today who can take up <em>any</em> task, <strong>regardless</strong> of the skill requirement.</p>
<p>每一个工人 <strong>最多</strong>&nbsp;能完成一个任务,并且只有在他们的技能等级 <strong>等于</strong>&nbsp;任务的技能要求时才能获取此任务。今天又有一名 <strong>额外</strong> 工人加入,他可以承接任何任务,<strong>无论</strong>&nbsp;技能要求如何。</p>

<p>Return the <strong>maximum</strong> total profit that can be earned by optimally assigning the tasks to the workers.</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">workers = [1,2,3,4,5], tasks = [[1,100],[2,400],[3,100],[3,400]]</span></p>
<p><span class="example-io"><b>输入:</b>workers = [1,2,3,4,5], tasks = [[1,100],[2,400],[3,100],[3,400]]</span></p>

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

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

<ul>
<li>Worker 0 completes task 0.</li>
<li>Worker 1 completes task 1.</li>
<li>Worker 2 completes task 3.</li>
<li>The additional worker completes task 2.</li>
<li>工人 0 完成任务 0。</li>
<li>工人 1 完成任务 1。</li>
<li>工人 2 完成任务 3。</li>
<li>额外工人完成任务 2。</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">workers = [10,10000,100000000], tasks = [[1,100]]</span></p>
<p><span class="example-io"><b>输入:</b>workers = [10,10000,100000000], tasks = [[1,100]]</span></p>

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

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

<p>Since no worker matches the skill requirement, only the additional worker can complete task 0.</p>
<p>由于没有工人满足技能需求,只有额外工人能够完成任务 0。</p>
</div>

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

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">workers = [7], tasks = [[3,3],[3,3]]</span></p>
<p><span class="example-io"><b>输入:</b>workers = [7], tasks = [[3,3],[3,3]]</span></p>

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

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

<p>The additional worker completes task 1. Worker 0 cannot work since no task has a skill requirement of 7.</p>
<p>额外工人完成任务 1。由于没有任务的技能需求为 7,工人 0 无法工作。</p>
</div>

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

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

<ul>
<li><code>1 &lt;= workers.length &lt;= 10<sup>5</sup></code></li>
Expand Down
2 changes: 1 addition & 1 deletion solution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3486,7 +3486,7 @@
| 3473 | [长度至少为 M 的 K 个子数组之和](/solution/3400-3499/3473.Sum%20of%20K%20Subarrays%20With%20Length%20at%20Least%20M/README.md) | | 中等 | 第 439 场周赛 |
| 3474 | [字典序最小的生成字符串](/solution/3400-3499/3474.Lexicographically%20Smallest%20Generated%20String/README.md) | | 困难 | 第 439 场周赛 |
| 3475 | [DNA 模式识别](/solution/3400-3499/3475.DNA%20Pattern%20Recognition/README.md) | | 中等 | |
| 3476 | [Maximize Profit from Task Assignment](/solution/3400-3499/3476.Maximize%20Profit%20from%20Task%20Assignment/README.md) | | 中等 | 🔒 |
| 3476 | [最大化任务分配的利润](/solution/3400-3499/3476.Maximize%20Profit%20from%20Task%20Assignment/README.md) | | 中等 | 🔒 |

## 版权

Expand Down