1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-07 08:21: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>有 <code>n</code> 个城市通过一些航班连接。给你一个数组&nbsp;<code>flights</code> ,其中&nbsp;<code>flights[i] = [from<sub>i</sub>, to<sub>i</sub>, price<sub>i</sub>]</code> ,表示该航班都从城市 <code>from<sub>i</sub></code> 开始,以价格 <code>price<sub>i</sub></code> 抵达 <code>to<sub>i</sub></code>。</p>\n\n<p>现在给定所有的城市和航班,以及出发城市 <code>src</code> 和目的地 <code>dst</code>,你的任务是找到出一条最多经过 <code>k</code>&nbsp;站中转的路线,使得从 <code>src</code> 到 <code>dst</code> 的 <strong>价格最便宜</strong> ,并返回该价格。 如果不存在这样的路线,则输出 <code>-1</code>。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong> \nn = 3, edges = [[0,1,100],[1,2,100],[0,2,500]]\nsrc = 0, dst = 2, k = 1\n<strong>输出:</strong> 200\n<strong>解释:</strong> \n城市航班图如下\n<img alt=\"\" src=\"https://s3-lc-upload.s3.amazonaws.com/uploads/2018/02/16/995.png\" style=\"height: 180px; width: 246px;\" />\n\n从城市 0 到城市 2 在 1 站中转以内的最便宜价格是 200如图中红色所示。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong> \nn = 3, edges = [[0,1,100],[1,2,100],[0,2,500]]\nsrc = 0, dst = 2, k = 0\n<strong>输出:</strong> 500\n<strong>解释:</strong> \n城市航班图如下\n<img alt=\"\" src=\"https://s3-lc-upload.s3.amazonaws.com/uploads/2018/02/16/995.png\" style=\"height: 180px; width: 246px;\" />\n\n从城市 0 到城市 2 在 0 站中转以内的最便宜价格是 500如图中蓝色所示。</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= n &lt;= 100</code></li>\n\t<li><code>0 &lt;= flights.length &lt;= (n * (n - 1) / 2)</code></li>\n\t<li><code>flights[i].length == 3</code></li>\n\t<li><code>0 &lt;= from<sub>i</sub>, to<sub>i</sub> &lt; n</code></li>\n\t<li><code>from<sub>i</sub> != to<sub>i</sub></code></li>\n\t<li><code>1 &lt;= price<sub>i</sub> &lt;= 10<sup>4</sup></code></li>\n\t<li>航班没有重复,且不存在自环</li>\n\t<li><code>0 &lt;= src, dst, k &lt; n</code></li>\n\t<li><code>src != dst</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 465,
"likes": 473,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Maximum Vacation Days\", \"titleSlug\": \"maximum-vacation-days\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u6700\\u5927\\u4f11\\u5047\\u5929\\u6570\"}]",
@@ -167,11 +167,11 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"49.4K\", \"totalSubmission\": \"127.2K\", \"totalAcceptedRaw\": 49392, \"totalSubmissionRaw\": 127165, \"acRate\": \"38.8%\"}",
"stats": "{\"totalAccepted\": \"50.9K\", \"totalSubmission\": \"130.9K\", \"totalAcceptedRaw\": 50932, \"totalSubmissionRaw\": 130861, \"acRate\": \"38.9%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "4\n[[0,1,100],[1,2,100],[2,0,100],[1,3,600],[2,3,200]]\n0\n3\n1",
"sampleTestCase": "3\n[[0,1,100],[1,2,100],[0,2,500]]\n0\n2\n1",
"metaData": "{\n \"name\": \"findCheapestPrice\",\n \"params\": [\n {\n \"name\": \"n\",\n \"type\": \"integer\"\n },\n {\n \"name\": \"flights\",\n \"type\": \"integer[][]\"\n },\n {\n \"name\": \"src\",\n \"type\": \"integer\"\n },\n {\n \"name\": \"dst\",\n \"type\": \"integer\"\n },\n {\n \"name\": \"k\",\n \"type\": \"integer\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n }\n}",
"judgerAvailable": true,
"judgeType": "large",