https://www.nowcoder.com/practice/22243d016f6b47f2a6928b4313c85387
动态规划
public static int jumpFloor1(int target) {
int[] dp = new int[target + 1];
dp[0] = 1;
dp[1] = 1;
for (int i = 2; i <= target; i++) {
dp[i] = 2 * dp[i - 1];
}
return dp[target];
}
递归
public static int jumpFloor2(int target) {
if (target <= 1)
return 1;
return 2 * jumpFloor2(target - 1);
}