1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个整数数组 <code>cost</code> ,其中 <code>cost[i]</code> 是从楼梯第 <code>i</code> 个台阶向上爬需要支付的费用。一旦你支付此费用,即可选择向上爬一个或者两个台阶。</p>\n\n<p>你可以选择从下标为 <code>0</code> 或下标为 <code>1</code> 的台阶开始爬楼梯。</p>\n\n<p>请你计算并返回达到楼梯顶部的最低花费。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>cost = [10,<em><strong>15</strong></em>,20]\n<strong>输出:</strong>15\n<strong>解释:</strong>你将从下标为 1 的台阶开始。\n- 支付 15 ,向上爬两个台阶,到达楼梯顶部。\n总花费为 15 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>cost = [<em><strong>1</strong></em>,100,<em><strong>1</strong></em>,1,<em><strong>1</strong></em>,100,<em><strong>1</strong></em>,<em><strong>1</strong></em>,100,<em><strong>1</strong></em>]\n<strong>输出:</strong>6\n<strong>解释:</strong>你将从下标为 0 的台阶开始。\n- 支付 1 ,向上爬两个台阶,到达下标为 2 的台阶。\n- 支付 1 ,向上爬两个台阶,到达下标为 4 的台阶。\n- 支付 1 ,向上爬两个台阶,到达下标为 6 的台阶。\n- 支付 1 ,向上爬一个台阶,到达下标为 7 的台阶。\n- 支付 1 ,向上爬两个台阶,到达下标为 9 的台阶。\n- 支付 1 ,向上爬一个台阶,到达楼梯顶部。\n总花费为 6 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 &lt;= cost.length &lt;= 1000</code></li>\n\t<li><code>0 &lt;= cost[i] &lt;= 999</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 851,
"likes": 856,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Climbing Stairs\", \"titleSlug\": \"climbing-stairs\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u722c\\u697c\\u68af\"}]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"192.3K\", \"totalSubmission\": \"314.5K\", \"totalAcceptedRaw\": 192339, \"totalSubmissionRaw\": 314485, \"acRate\": \"61.2%\"}",
"stats": "{\"totalAccepted\": \"193.5K\", \"totalSubmission\": \"316.2K\", \"totalAcceptedRaw\": 193481, \"totalSubmissionRaw\": 316167, \"acRate\": \"61.2%\"}",
"hints": [
"Say f[i] is the final cost to climb to the top from step i. Then f[i] = cost[i] + min(f[i+1], f[i+2])."
],