标签:object 相同 etc lan for pen 青蛙跳 跳台阶 ima
动态规划(其它方法同斐波那契数列)
Python
class Solution(object):
def numWays(self, n):
"""
:type n: int
:rtype: int
"""
dp = []
dp.append(1)
dp.append(1)
for i in range(2, n + 1):
dp.append((dp[i - 1] + dp[i - 2]) % 1000000007)
return dp[n]
标签:object 相同 etc lan for pen 青蛙跳 跳台阶 ima
原文地址:https://www.cnblogs.com/cling-cling/p/12912116.html