题解 | #跳台阶#
跳台阶
http://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4
//JAVA
//用最小事件去递归
//n>2 时 f(n) = f(n-1) + f(n-2)
public class Solution {
public int jumpFloor(int target) {
if(target <= 2) return target;
return jumpFloor(target-1) + jumpFloor(target-2);
}
}