mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-09 01:11:42 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>一个有名的按摩师会收到源源不断的预约请求,每个预约都可以选择接或不接。在每次预约服务之间要有休息时间,因此她不能接受相邻的预约。给定一个预约请求序列,替按摩师找到最优的预约集合(总预约时间最长),返回总的分钟数。</p>\n\n<p><strong>注意:</strong>本题相对原题稍作改动</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong> [1,2,3,1]\n<strong>输出:</strong> 4\n<strong>解释:</strong> 选择 1 号预约和 3 号预约,总时长 = 1 + 3 = 4。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong> [2,7,9,3,1]\n<strong>输出:</strong> 12\n<strong>解释:</strong> 选择 1 号预约、 3 号预约和 5 号预约,总时长 = 2 + 9 + 1 = 12。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong> [2,1,4,5,3,1,1,3]\n<strong>输出:</strong> 12\n<strong>解释:</strong> 选择 1 号预约、 3 号预约、 5 号预约和 8 号预约,总时长 = 2 + 4 + 3 + 3 = 12。\n</pre>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 231,
|
||||
"likes": 237,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"66.4K\", \"totalSubmission\": \"128.8K\", \"totalAcceptedRaw\": 66367, \"totalSubmissionRaw\": 128819, \"acRate\": \"51.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"67.4K\", \"totalSubmission\": \"130.9K\", \"totalAcceptedRaw\": 67362, \"totalSubmissionRaw\": 130914, \"acRate\": \"51.5%\"}",
|
||||
"hints": [
|
||||
"此题有递归和遍历两种解法,但从递归开始可能更容易一些。",
|
||||
"递归解法:每个预约都有两个选择(接受预约或拒绝预约)。作为一种蛮力方法,你可以在所有可能性的地方递归。但是请注意,如果接收了预约请求i,那么你的递归算法应该跳过预约请求i + 1。",
|
||||
|
Reference in New Issue
Block a user