import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param number int整型
* @return int整型
*/
public int jumpFloor (int number) {
// write code here
if(number == 1) return 1;
if(number == 2) return 2;
int a = 1;
int b = 2;
int res = 0;
for(int i = 3; i <= number; i++){//
res = a + b;
a = b;
b = res;
}
return res;
}
}
跟斐波那契数列很像