当前位置:网站首页>LeetCode refers to offer 10-I. Fibonacci sequence (simple)
LeetCode refers to offer 10-I. Fibonacci sequence (simple)
2022-08-10 05:55:00 【Shengxin Research Ape】
python
class Solution:
def fib(self, n: int) -> int:
if(n==0 ):
return 0
if(n==1 ):
return 1
a = 0
b = 1
i = 2
while (i<=n):
c = b
b = a+b
a = c
i +=1
b = int(b%(1e9+7))
# print(b)
return b
边栏推荐
猜你喜欢
随机推荐
I use this recruit let the team to improve the development efficiency of 100%!
Chain Reading Recommendation: From Tiles to Generative NFTs
Small program wx.request simple Promise package
LeetCode 1720.解码异或后的数组(简单)
复杂的“元宇宙”,为您解读,链读APP即将上线!
十年磨一剑!数字藏品行情软件,链读APP正式开放内测!
LeetCode 剑指offer 10-I.斐波那契数列(简单)
知识蒸馏论文学习
error in ./node_modules/cesium/Source/ThirdParty/zip.js
Models corresponding to each architecture instruction set
开源免费WMS仓库管理系统【推荐】
网络安全之防火墙
连接 Nacos 报超时错误
Operation table Function usage
pytorch-05.用pytorch实现线性回归
sqlplus displays the previous command and the available backspace key
链读精选:星巴克着眼于数字收藏品并更好地吸引客户
The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
Notes 1
opencv