public class Solution { public int jumpFloorII(int target) { return (int)Math.pow(2,target-1); } }
f(n)=f(n-1)+f(n-2)+...+f(1)
f(n-1)=f(n-2)+...f(1)
得:f(n)=2f(n-1)=2^2f(n-2) = 2^(n-1)*1
public class Solution { public int jumpFloorII(int target) { return (int)Math.pow(2,target-1); } }
f(n)=f(n-1)+f(n-2)+...+f(1)
f(n-1)=f(n-2)+...f(1)
得:f(n)=2f(n-1)=2^2f(n-2) = 2^(n-1)*1