class Solution:
"""
@param: : an integer
@return: an ineger f(n)
"""
def fibonacci(self, n):
# write your code here
ret = [0, 1]
for i in range(2, n):
ret.append(ret[i - 2] + ret[i - 1])
return ret[n - 1]
[LintCode]Fibonacci(Python)
最新推荐文章于 2025-05-06 23:38:51 发布