mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 04:31:55 +08:00
Polish the content.
This commit is contained in:
@ -117,7 +117,7 @@
|
||||
我们可以尝试从问题分解的角度分析这道题。设爬到第 $i$ 阶共有 $dp[i]$ 种方案,那么 $dp[i]$ 就是原问题,其子问题包括:
|
||||
|
||||
$$
|
||||
dp[i-1] , dp[i-2] , \cdots , dp[2] , dp[1]
|
||||
dp[i-1] , dp[i-2] , \dots , dp[2] , dp[1]
|
||||
$$
|
||||
|
||||
由于每轮只能上 $1$ 阶或 $2$ 阶,因此当我们站在第 $i$ 阶楼梯上时,上一轮只可能站在第 $i - 1$ 阶或第 $i - 2$ 阶上。换句话说,我们只能从第 $i -1$ 阶或第 $i - 2$ 阶前往第 $i$ 阶。
|
||||
|
||||
Reference in New Issue
Block a user