Skip to content

Commit

Permalink
update 使用最小花费爬楼梯.md
Browse files Browse the repository at this point in the history
优化文档中的语言描述
  • Loading branch information
he-weilai committed Mar 29, 2023
1 parent ca22215 commit 7e02650
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion problems/0746.使用最小花费爬楼梯.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dp[i - 2] 跳到 dp[i] 需要花费 dp[i - 2] + cost[i - 2]。

这里就要说明本题力扣为什么改题意,而且修改题意之后 就清晰很多的原因了。

新题目描述中明确说了 “你可以选择从下标为 0 或下标为 1 的台阶开始爬楼梯。” 也就是说 到达 第 0 个台阶是不花费的,但从 第0 个台阶 往上跳的话,需要花费 cost[0]
新题目描述中明确说了 “你可以选择从下标为 0 或下标为 1 的台阶开始爬楼梯。” 也就是说 到达 第 0 个台阶是不花费的,但从 第0 个台阶 往上跳的话,需要花费 cost[0]

所以初始化 dp[0] = 0,dp[1] = 0;

Expand Down

0 comments on commit 7e02650

Please sign in to comment.