mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-11-19 12:43:46 +00:00
Update 10.4 变态跳台阶.md
方法名按 Java 的命名习惯改为 jumpFloorII。
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ f(n) = 2*f(n-1)
|
||||
第一步的展开要求 n - 1 ≥ 1,所以上式在 n ≥ 2 时成立;又 f(1) = 1,因此 f(n) = 2<sup>n-1</sup>,例如 f(4) = 8。
|
||||
|
||||
```java
|
||||
public int JumpFloorII(int target) {
|
||||
public int jumpFloorII(int target) {
|
||||
return (int) Math.pow(2, target - 1);
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user