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>time</code>&nbsp;秒的体育赛事。这些片段可能有所重叠,也可能长度不一。</p>\n\n<p>使用数组&nbsp;<code>clips</code> 描述所有的视频片段,其中 <code>clips[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> 表示:某个视频片段开始于&nbsp;<code>start<sub>i</sub></code>&nbsp;并于&nbsp;<code>end<sub>i</sub></code>&nbsp;结束。</p>\n\n<p>甚至可以对这些片段自由地再剪辑:</p>\n\n<ul>\n\t<li>例如,片段&nbsp;<code>[0, 7]</code>&nbsp;可以剪切成&nbsp;<code>[0, 1] +&nbsp;[1, 3] + [3, 7]</code>&nbsp;三部分。</li>\n</ul>\n\n<p>我们需要将这些片段进行再剪辑,并将剪辑后的内容拼接成覆盖整个运动过程的片段(<code>[0, time]</code>)。返回所需片段的最小数目,如果无法完成该任务,则返回&nbsp;<code>-1</code> 。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>clips = [[0,2],[4,6],[8,10],[1,9],[1,5],[5,9]], time = 10\n<strong>输出:</strong>3\n<strong>解释:</strong>\n选中 [0,2], [8,10], [1,9] 这三个片段。\n然后按下面的方案重制比赛片段\n将 [1,9] 再剪辑为 [1,2] + [2,8] + [8,9] 。\n现在手上的片段为 [0,2] + [2,8] + [8,10],而这些覆盖了整场比赛 [0, 10]。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>clips = [[0,1],[1,2]], time = 5\n<strong>输出:</strong>-1\n<strong>解释:</strong>\n无法只用 [0,1] 和 [1,2] 覆盖 [0,5] 的整个过程。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>clips = [[0,1],[6,8],[0,2],[5,6],[0,4],[0,3],[6,7],[1,3],[4,7],[1,4],[2,5],[2,6],[3,4],[4,5],[5,7],[6,9]], time = 9\n<strong>输出:</strong>3\n<strong>解释: </strong>\n选取片段 [0,4], [4,7] 和 [6,9] 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= clips.length &lt;= 100</code></li>\n\t<li><code>0 &lt;= start<sub>i</sub> &lt;= end<sub>i</sub> &lt;= 100</code></li>\n\t<li><code>1 &lt;= time &lt;= 100</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 265,
"likes": 269,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"36.7K\", \"totalSubmission\": \"66.7K\", \"totalAcceptedRaw\": 36718, \"totalSubmissionRaw\": 66685, \"acRate\": \"55.1%\"}",
"stats": "{\"totalAccepted\": \"37.3K\", \"totalSubmission\": \"68.1K\", \"totalAcceptedRaw\": 37322, \"totalSubmissionRaw\": 68071, \"acRate\": \"54.8%\"}",
"hints": [
"What if we sort the intervals? Considering the sorted intervals, how can we solve the problem with dynamic programming?",
"Let's consider a DP(pos, limit) where pos represents the position of the current interval we are gonna take the decision and limit is the current covered area from [0 - limit]. This DP returns the minimum number of taken intervals or infinite if it's not possible to cover the [0 - T] section."