1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-07 00:11:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>你需要制定一份&nbsp;<code>d</code>&nbsp;天的工作计划表。工作之间存在依赖,要想执行第&nbsp;<code>i</code>&nbsp;项工作,你必须完成全部&nbsp;<code>j</code>&nbsp;项工作(&nbsp;<code>0 &lt;= j &lt; i</code>)。</p>\n\n<p>你每天 <strong>至少</strong>&nbsp;需要完成一项任务。工作计划的总难度是这&nbsp;<code>d</code>&nbsp;天每一天的难度之和,而一天的工作难度是当天应该完成工作的最大难度。</p>\n\n<p>给你一个整数数组&nbsp;<code>jobDifficulty</code>&nbsp;和一个整数&nbsp;<code>d</code>,分别代表工作难度和需要计划的天数。第&nbsp;<code>i</code>&nbsp;项工作的难度是&nbsp;<code>jobDifficulty[i]</code>。</p>\n\n<p>返回整个工作计划的 <strong>最小难度</strong> 。如果无法制定工作计划,则返回&nbsp;<strong>-1&nbsp;</strong>。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/01/26/untitled.png\" style=\"height: 304px; width: 365px;\"></p>\n\n<pre><strong>输入:</strong>jobDifficulty = [6,5,4,3,2,1], d = 2\n<strong>输出:</strong>7\n<strong>解释:</strong>第一天,您可以完成前 5 项工作,总难度 = 6.\n第二天您可以完成最后一项工作总难度 = 1.\n计划表的难度 = 6 + 1 = 7 \n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>jobDifficulty = [9,9,9], d = 4\n<strong>输出:</strong>-1\n<strong>解释:</strong>就算你每天完成一项工作,仍然有一天是空闲的,你无法制定一份能够满足既定工作时间的计划表。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>jobDifficulty = [1,1,1], d = 3\n<strong>输出:</strong>3\n<strong>解释:</strong>工作计划为每天一项工作,总难度为 3 。\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre><strong>输入:</strong>jobDifficulty = [7,1,7,1,7,1], d = 3\n<strong>输出:</strong>15\n</pre>\n\n<p><strong>示例 5</strong></p>\n\n<pre><strong>输入:</strong>jobDifficulty = [11,111,22,222,33,333,44,444], d = 6\n<strong>输出:</strong>843\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= jobDifficulty.length &lt;= 300</code></li>\n\t<li><code>0 &lt;=&nbsp;jobDifficulty[i] &lt;= 1000</code></li>\n\t<li><code>1 &lt;= d &lt;= 10</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 73,
"likes": 74,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.1K\", \"totalSubmission\": \"7K\", \"totalAcceptedRaw\": 4144, \"totalSubmissionRaw\": 6959, \"acRate\": \"59.5%\"}",
"stats": "{\"totalAccepted\": \"4.2K\", \"totalSubmission\": \"7.1K\", \"totalAcceptedRaw\": 4242, \"totalSubmissionRaw\": 7128, \"acRate\": \"59.5%\"}",
"hints": [
"Use DP. Try to cut the array into d non-empty sub-arrays. Try all possible cuts for the array.",
"Use dp[i][j] where DP states are i the index of the last cut and j the number of remaining cuts. Complexity is O(n * n * d)."