易知 f(n)=f(n-1)+f(n-2)+……f(1)
f(n-1)=f(n-2)+……f(1)
两式相减得f(n)=2f(n-1)
# -*- coding:utf-8 -*- class Solution: def jumpFloorII(self, number): # write code here n=1 for i in range(2,number+1): n=2*n return n
易知 f(n)=f(n-1)+f(n-2)+……f(1)
f(n-1)=f(n-2)+……f(1)
两式相减得f(n)=2f(n-1)
# -*- coding:utf-8 -*- class Solution: def jumpFloorII(self, number): # write code here n=1 for i in range(2,number+1): n=2*n return n