题解 | #删除链表的节点#
跳台阶
http://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4
- target=1,res=1;
- target=2,res=2;
- target=3,res=3;
- target=4,res=5;
- 递推公式为 res(n)=res(n-1)+res(n-2);
public class Solution {
public int jumpFloor(int target) {
if(target==1){
return 1;
}
if(target==2){
return 2;
}else{
return (int) jumpFloor(target-1)+jumpFloor(target-2);
}
}
}
