剑指offer-变态跳台阶

题目描述:一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。

ac代码:

 1 public class Solution {
 2     static int str[]=new int[39];
 3     static {
 4         
 5         str[1]=1;
 6         str[2]=2;
 7         for(int i=3;i<39;i++)
 8         {
 9             str[i]=str[i-1]*2;
10         }
11     }
12     public int JumpFloorII(int target) {
13         return str[target];
14     }
15 }
原文地址:https://www.cnblogs.com/llsq/p/8796161.html