classSolution(object):defnumWays(self, n):"""
:type n: int
:rtype: int
"""
a, b =0,1
num =1for _ inrange(n-1):
a, b = b , a+b
num =(num + a)%1000000007return num
【leetcode-python-33】面试题10- II. 青蛙跳台阶问题渣渣原始版(85.62%)leetcode 面试题10- II. 青蛙跳台阶问题渣渣原始版(85.62%)总方法数 = 跳最后一阶楼梯方法数 + 跳最后两阶楼梯方法数class Solution(object): def numWays(self, n): """ :type n: int :rtype: int """ a, b = 0