class Solution(object):
def fib(self, n):
"""
:type n: int
:rtype: int
"""
a, b = 0, 1
for i in range(n):
a, b = b%1000000007, (a+b)%1000000007
return a
剑指 Offer 10- I. 斐波那契数列
最新推荐文章于 2023-01-18 18:23:32 发布