diff --git a/notes/10.3 跳台阶.md b/notes/10.3 跳台阶.md index 06c7433d..2d7d7c93 100644 --- a/notes/10.3 跳台阶.md +++ b/notes/10.3 跳台阶.md @@ -8,21 +8,21 @@ 一只青蛙一次可以跳上 1 级台阶,也可以跳上 2 级。求该青蛙跳上一个 n 级的台阶总共有多少种跳法。 -

+

## 解题思路 当 n = 1 时,只有一种跳法: -

+

当 n = 2 时,有两种跳法: -

+

跳 n 阶台阶,可以先跳 1 阶台阶,再跳 n-1 阶台阶;或者先跳 2 阶台阶,再跳 n-2 阶台阶。而 n-1 和 n-2 阶台阶的跳法可以看成子问题,该问题的递推公式为: -

+

```java public int trainWays(int num) { diff --git a/notes/pics/jump-floor-formula.png b/notes/pics/jump-floor-formula.png new file mode 100644 index 00000000..1338e2d5 Binary files /dev/null and b/notes/pics/jump-floor-formula.png differ diff --git a/notes/pics/jump-floor-n1.png b/notes/pics/jump-floor-n1.png new file mode 100644 index 00000000..e1eb1754 Binary files /dev/null and b/notes/pics/jump-floor-n1.png differ diff --git a/notes/pics/jump-floor-n2.png b/notes/pics/jump-floor-n2.png new file mode 100644 index 00000000..1a0d2299 Binary files /dev/null and b/notes/pics/jump-floor-n2.png differ diff --git a/notes/pics/jump-floor-problem.png b/notes/pics/jump-floor-problem.png new file mode 100644 index 00000000..d9b51d45 Binary files /dev/null and b/notes/pics/jump-floor-problem.png differ