青蛙跳台阶
dp[n]=dp[n-1]+dp[n-2]
class Solution: def findways(self,number): if number==1 or number ==2: return number dp=[1,2] for i in range(number-2): dp.append(dp[-1]+dp[-2]) return dp[-1]
dp[n]=dp[n-1]+dp[n-2]
class Solution: def findways(self,number): if number==1 or number ==2: return number dp=[1,2] for i in range(number-2): dp.append(dp[-1]+dp[-2]) return dp[-1]