
题目描述
一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果)。
思路
Just write down the result array and we find that the Array is (1),1,2,3,5,8,13,21…
It is a Fibonacci array!
But it start from the second num, be careful for the index.
代码
1 |
public int JumpFloor(int target) { |




近期评论