当前位置:网站首页>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
边栏推荐
- The Principle of Union Search and API Design
- 优先队列
- Mini Program Study Notes: Communication between Mini Program Components
- [List Exercise] Traverse the collection and sort by price from low to high,
- String常用方法
- 数据库 笔记 创建数据库、表 备份
- 视图【】【】【】【】
- 知识蒸馏论文学习
- Multi-table query Notes
- Reprint fstream, detailed usage of ifstream
猜你喜欢
随机推荐
2021-06-22
索引笔记【】【】
Batch add watermark to pictures batch scale pictures to specified size
图片批量添加水印批量缩放图片到指定大小
[Difference between el and template]
ORACLE system table space SYSTEM is full and cannot expand table space problem solving process
集合 set接口
GUI_AWT
Link reading good article: What is the difference between hot encrypted storage and cold encrypted storage?
棋类游戏-五子棋小游戏
深度学习阶段性报告(一)
tinymce rich text editor
Timer (setInterval) on and off
Set Sources Resources and other folders in the IDEA project
智能合约和去中心化应用DAPP
ORACLE系统表空间SYSTEM占满无法扩充表空间问题解决过程
MySQL中MyISAM为什么比InnoDB查询快
菜谱小程序源码免费分享【推荐】
学生管理系统以及其简单功能的实现
wiki confluence installation









