1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 14:12:17 +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>给你一个下标从 <strong>0</strong>&nbsp;开始的二维整数数组&nbsp;<code>questions</code>&nbsp;,其中&nbsp;<code>questions[i] = [points<sub>i</sub>, brainpower<sub>i</sub>]</code>&nbsp;。</p>\n\n<p>这个数组表示一场考试里的一系列题目,你需要 <strong>按顺序</strong>&nbsp;(也就是从问题 <code>0</code><strong>&nbsp;</strong>开始依次解决),针对每个问题选择 <strong>解决</strong>&nbsp;或者 <strong>跳过</strong>&nbsp;操作。解决问题 <code>i</code>&nbsp;将让你 <b>获得</b>&nbsp;&nbsp;<code>points<sub>i</sub></code>&nbsp;的分数,但是你将 <strong>无法</strong>&nbsp;解决接下来的&nbsp;<code>brainpower<sub>i</sub></code>&nbsp;个问题(即只能跳过接下来的 <code>brainpower<sub>i</sub></code><sub>&nbsp;</sub>个问题)。如果你跳过问题&nbsp;<code>i</code>&nbsp;,你可以对下一个问题决定使用哪种操作。</p>\n\n<ul>\n\t<li>比方说,给你&nbsp;<code>questions = [[3, 2], [4, 3], [4, 4], [2, 5]]</code>&nbsp;\n\n\t<ul>\n\t\t<li>如果问题&nbsp;<code>0</code>&nbsp;被解决了, 那么你可以获得&nbsp;<code>3</code>&nbsp;分,但你不能解决问题&nbsp;<code>1</code> 和&nbsp;<code>2</code>&nbsp;。</li>\n\t\t<li>如果你跳过问题&nbsp;<code>0</code>&nbsp;,且解决问题&nbsp;<code>1</code>&nbsp;,你将获得 <code>4</code> 分但是不能解决问题&nbsp;<code>2</code> 和&nbsp;<code>3</code>&nbsp;。</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>请你返回这场考试里你能获得的 <strong>最高</strong>&nbsp;分数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><b>输入:</b>questions = [[3,2],[4,3],[4,4],[2,5]]\n<b>输出:</b>5\n<b>解释:</b>解决问题 0 和 3 得到最高分。\n- 解决问题 0 :获得 3 分,但接下来 2 个问题都不能解决。\n- 不能解决问题 1 和 2\n- 解决问题 3 :获得 2 分\n总得分为3 + 2 = 5 。没有别的办法获得 5 分或者多于 5 分。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>questions = [[1,1],[2,2],[3,3],[4,4],[5,5]]\n<b>输出:</b>7\n<b>解释:</b>解决问题 1 和 4 得到最高分。\n- 跳过问题 0\n- 解决问题 1 :获得 2 分,但接下来 2 个问题都不能解决。\n- 不能解决问题 2 和 3\n- 解决问题 4 :获得 5 分\n总得分为2 + 5 = 7 。没有别的办法获得 7 分或者多于 7 分。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= questions.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>questions[i].length == 2</code></li>\n\t<li><code>1 &lt;= points<sub>i</sub>, brainpower<sub>i</sub> &lt;= 10<sup>5</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 40,
"likes": 43,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"14.7K\", \"totalAcceptedRaw\": 6012, \"totalSubmissionRaw\": 14689, \"acRate\": \"40.9%\"}",
"stats": "{\"totalAccepted\": \"6.4K\", \"totalSubmission\": \"15.6K\", \"totalAcceptedRaw\": 6420, \"totalSubmissionRaw\": 15559, \"acRate\": \"41.3%\"}",
"hints": [
"For each question, we can either solve it or skip it. How can we use Dynamic Programming to decide the most optimal option for each problem?",
"We store for each question the maximum points we can earn if we started the exam on that question.",