依旧和上题一样递归,模板一样
同样的味道,同样的感觉
# -*- coding:utf-8 -*- class Solution: def rectCover(self, number): # write code here if number==0: return 0 elif number==1: return 1 elif number==2: return 2 res=[0,1,2] for i in range(3,number+1): res.append(res[i-1]+res[i-2]) return res[-1]