变态跳台阶
变态跳台阶
http://www.nowcoder.com/questionTerminal/22243d016f6b47f2a6928b4313c85387
变态跳台阶
public class Solution { public int JumpFloorII(int target) { if(target <= 2) return target; int[] v = new int[target + 1]; v[1] = 1; v[2] = 2; return f(target, v); } int f(int target, int[] v){ int sum = 1; for(int i = 1; i < target; ++i){ if(v[i] == 0){ int temp = f(i, v); v[i] = temp; } sum += v[i]; } return sum; } }