当前位置:网站首页>LeetCode 剑指offer 10-I.斐波那契数列(简单)
LeetCode 剑指offer 10-I.斐波那契数列(简单)
2022-08-10 05:32:00 【生信研究猿】
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
边栏推荐
- Ten years of sharpening a sword!The digital collection market software, Link Reading APP is officially open for internal testing!
- IO stream【】【】【】
- 行盒子的盒模型
- sqlplus 显示上一条命令及可用退格键
- [List Exercise] Traverse the collection and sort by price from low to high,
- ACID四种特性
- cesium listens to map zoom or zoom to control whether the content added on the map is displayed
- 作业实验四
- 微信小程序wx.writeBLECharacteristicValue汉字转buffer问题
- 共识计算和激励机制
猜你喜欢
Timer (setInterval) on and off
树结构——二叉查找树原理与实现
并查集原理与API设计
Day1 微信小程序-小程序代码的构成
The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
Batch add watermark to pictures batch add background zoom batch merge tool picUnionV4.0
Reflection 【Notes】
Count down the six weapons of the domestic interface collaboration platform!
IDEA 项目中设置 Sources Resources 等文件夹
细说MySql索引原理
随机推荐
链读 | 最新最全的数字藏品发售日历-07.28
impdp import data
【el和template区别】
小程序wx.request简单Promise封装
Reflection 【Notes】
视图【】【】【】【】
One step ahead, don't miss it again, the chain reading APP will be launched soon!
反射【笔记】
链读|最新最全的数字藏品发售日历-07.29
el-dropdown下拉菜单样式修改,去掉小三角
Decentralized and p2p networks and traditional communications with centralization at the core
网络安全作业
复杂的“元宇宙”,为您解读,链读APP即将上线!
Knowledge Distillation Thesis Learning
链读|最新最全的数字藏品发售日历-08.02
Multi-table query Notes
Link reading good article: What is the difference between hot encrypted storage and cold encrypted storage?
【笔记】集合框架体系 Collection
小程序学习笔记:小程序组件间通信方式
定时器(setInterval)的开启与关闭