[剑指offer]跳台阶

思路: 跳一节有一种,跳两节有两种,跳三节有f(1)+f(2)种,跳N节有f(N-1)+f(N-2)种,就是一个斐波那契数列。 实现: public class Solution { public int JumpFloor(int target) { if(target<=2)return target; int n1=1; int n2=
相关文章
相关标签/搜索