mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始的二维整数数组 <code>events</code> ,其中 <code>events[i] = [startTime<sub>i</sub>, endTime<sub>i</sub>, value<sub>i</sub>]</code> 。第 <code>i</code> 个活动开始于 <code>startTime<sub>i</sub></code> ,结束于 <code>endTime<sub>i</sub></code> ,如果你参加这个活动,那么你可以得到价值 <code>value<sub>i</sub></code> 。你 <strong>最多</strong> 可以参加 <strong>两个时间不重叠</strong> 活动,使得它们的价值之和 <strong>最大</strong> 。</p>\n\n<p>请你返回价值之和的 <strong>最大值</strong> 。</p>\n\n<p>注意,活动的开始时间和结束时间是 <strong>包括</strong> 在活动时间内的,也就是说,你不能参加两个活动且它们之一的开始时间等于另一个活动的结束时间。更具体的,如果你参加一个活动,且结束时间为 <code>t</code> ,那么下一个活动必须在 <code>t + 1</code> 或之后的时间开始。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/09/21/picture5.png\" style=\"width: 400px; height: 75px;\"></p>\n\n<pre><b>输入:</b>events = [[1,3,2],[4,5,2],[2,4,3]]\n<b>输出:</b>4\n<strong>解释:</strong>选择绿色的活动 0 和 1 ,价值之和为 2 + 2 = 4 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"Example 1 Diagram\" src=\"https://assets.leetcode.com/uploads/2021/09/21/picture1.png\" style=\"width: 400px; height: 77px;\"></p>\n\n<pre><b>输入:</b>events = [[1,3,2],[4,5,2],[1,5,5]]\n<b>输出:</b>5\n<strong>解释:</strong>选择活动 2 ,价值和为 5 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/09/21/picture3.png\" style=\"width: 400px; height: 66px;\"></p>\n\n<pre><b>输入:</b>events = [[1,5,3],[1,5,1],[6,6,5]]\n<b>输出:</b>8\n<strong>解释:</strong>选择活动 0 和 2 ,价值之和为 3 + 5 = 8 。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= events.length <= 10<sup>5</sup></code></li>\n\t<li><code>events[i].length == 3</code></li>\n\t<li><code>1 <= startTime<sub>i</sub> <= endTime<sub>i</sub> <= 10<sup>9</sup></code></li>\n\t<li><code>1 <= value<sub>i</sub> <= 10<sup>6</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 47,
|
||||
"likes": 48,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -167,7 +167,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"13.5K\", \"totalAcceptedRaw\": 5292, \"totalSubmissionRaw\": 13466, \"acRate\": \"39.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"13.5K\", \"totalAcceptedRaw\": 5294, \"totalSubmissionRaw\": 13470, \"acRate\": \"39.3%\"}",
|
||||
"hints": [
|
||||
"How can sorting the events on the basis of their start times help? How about end times?",
|
||||
"How can we quickly get the maximum score of an interval not intersecting with the interval we chose?"
|
||||
|
Reference in New Issue
Block a user