mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>你驾驶出租车行驶在一条有 <code>n</code> 个地点的路上。这 <code>n</code> 个地点从近到远编号为 <code>1</code> 到 <code>n</code> ,你想要从 <code>1</code> 开到 <code>n</code> ,通过接乘客订单盈利。你只能沿着编号递增的方向前进,不能改变方向。</p>\n\n<p>乘客信息用一个下标从 <strong>0</strong> 开始的二维数组 <code>rides</code> 表示,其中 <code>rides[i] = [start<sub>i</sub>, end<sub>i</sub>, tip<sub>i</sub>]</code> 表示第 <code>i</code> 位乘客需要从地点 <code>start<sub>i</sub></code> 前往 <code>end<sub>i</sub></code> ,愿意支付 <code>tip<sub>i</sub></code> 元的小费。</p>\n\n<p><strong>每一位</strong> 你选择接单的乘客 <code>i</code> ,你可以 <strong>盈利</strong> <code>end<sub>i</sub> - start<sub>i</sub> + tip<sub>i</sub></code> 元。你同时 <strong>最多</strong> 只能接一个订单。</p>\n\n<p>给你 <code>n</code> 和 <code>rides</code> ,请你返回在最优接单方案下,你能盈利 <strong>最多</strong> 多少元。</p>\n\n<p><strong>注意:</strong>你可以在一个地点放下一位乘客,并在同一个地点接上另一位乘客。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><b>输入:</b>n = 5, rides = [<em><strong>[2,5,4]</strong></em>,[1,5,1]]\n<b>输出:</b>7\n<b>解释:</b>我们可以接乘客 0 的订单,获得 5 - 2 + 4 = 7 元。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><b>输入:</b>n = 20, rides = [[1,6,1],<strong><em>[3,10,2]</em></strong>,<em><strong>[10,12,3]</strong></em>,[11,12,2],[12,15,2],<strong><em>[13,18,1]</em></strong>]\n<b>输出:</b>20\n<b>解释:</b>我们可以接以下乘客的订单:\n- 将乘客 1 从地点 3 送往地点 10 ,获得 10 - 3 + 2 = 9 元。\n- 将乘客 2 从地点 10 送往地点 12 ,获得 12 - 10 + 3 = 5 元。\n- 将乘客 5 从地点 13 送往地点 18 ,获得 18 - 13 + 1 = 6 元。\n我们总共获得 9 + 5 + 6 = 20 元。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= n <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= rides.length <= 3 * 10<sup>4</sup></code></li>\n\t<li><code>rides[i].length == 3</code></li>\n\t<li><code>1 <= start<sub>i</sub> < end<sub>i</sub> <= n</code></li>\n\t<li><code>1 <= tip<sub>i</sub> <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 24,
|
||||
"likes": 27,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.4K\", \"totalSubmission\": \"7.8K\", \"totalAcceptedRaw\": 3405, \"totalSubmissionRaw\": 7803, \"acRate\": \"43.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"8.3K\", \"totalAcceptedRaw\": 3643, \"totalSubmissionRaw\": 8338, \"acRate\": \"43.7%\"}",
|
||||
"hints": [
|
||||
"Can we sort the array to help us solve the problem?",
|
||||
"We can use dynamic programming to keep track of the maximum at each position."
|
||||
|
Reference in New Issue
Block a user