劍指offer、牛客-變態跳臺階
數歸法:可得:
public class Solution {
public int JumpFloorII(int n) {
if(n <= 0)
return 0;
if(n == 1)
return 1;
int result = 1;
for(int k = 2; k <= n; k++){
result = result * 2;
}
return result;
}
}