当前位置:网站首页>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
边栏推荐
- Chain Reading Good Article: Jeff Garzik Launches Web3 Production Company
- IO流【】【】【】
- error in ./node_modules/cesium/Source/ThirdParty/zip.js
- LeetCode 94.二叉树的中序遍历(简单)
- 分享一款恋爱星座男女配对微信小程序源码
- wiki confluence installation
- The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
- Timer (setInterval) on and off
- 微信小程序wx.writeBLECharacteristicValue汉字转buffer问题
- The latest and most complete digital collection sales calendar-07.27
猜你喜欢
21天挑战杯MySQL-Day05
LeetCode 938.二叉搜索树的范围和(简单)
Analysis of the investment value of domestic digital collections
Multi-table query Notes
一个基于.Net Core 开源的物联网基础平台
Ten years of sharpening a sword!The digital collection market software, Link Reading APP is officially open for internal testing!
Collection Map
深度学习阶段性报告(一)
2022李宏毅机器学习hw1--COVID-19 Cases Prediction
最新最全的数字藏品发售日历-07.27
随机推荐
[List Exercise] Traverse the collection and sort by price from low to high,
链读好文:热加密存储与冷加密存储有什么区别?
【笔记】集合框架体系 Collection
转载fstream,ifstream的详细用法
Chain Reading|The latest and most complete digital collection sales calendar-07.29
Batch add watermark to pictures batch scale pictures to specified size
Chain Reading | The latest and most complete digital collection calendar-07.28
力扣——统计只差一个字符的子串数目
pytorch-11.卷积神经网络(高级篇)
I use this recruit let the team to improve the development efficiency of 100%!
卷积神经网络(CNN)实现mnist手写数字识别
Collection set interface
程序员副业赚钱之道,实现月收入增加20K
事务、存储引擎
链读推荐:从瓷砖到生成式 NFT
机器学习——聚类——商场客户聚类
Count down the six weapons of the domestic interface collaboration platform!
generic notes()()()
network security firewall
A little knowledge point every day