思路:简单递归,脚本语言实现即可

class Solution:
    def fib(self, n: int) -> int:
        res=[0,1,1]
        if n<=2:
            return res[n]
        for i in range(3,n+1):
            res.append(res[i-1]+res[i-2])
        return res[n]%(10**9+7)