当前位置:网站首页>Sword finger offer | Fibonacci sequence
Sword finger offer | Fibonacci sequence
2022-06-28 09:35:00 【Minor Yapi】
Use recursion or loops .
1 1 2 3 5 …
public int Fibonacci(int n) {
if(n<=1){
return n;
}
//return Fibonacci(n-1)+Fibonacci(n-2);
int a=0,b=1;
while(--n>0){
int flag = a;
a = b;
b = flag+b;
}
return b;
}
边栏推荐
- 1180:分数线划定/P1068 [NOIP2009 普及组] 分数线划定
- Apache Doris becomes the top project of Apache
- Divide and rule classic Hanoi
- 创建多线程的方法---1创建Thread类的子类及多线程原理
- Implementation of single sign on
- Interpretation of new products: realm launched GT neo2 Dragon Ball customized version
- PMP考试重点总结五——执行过程组
- 图解MySQL的binlog、redo log和undo log
- flink cep 跳过策略 AfterMatchSkipStrategy.skipPastLastEvent() 匹配过的不再匹配 碧坑指南
- Screen settings in the source code of OBS Live Room
猜你喜欢

JVM系列(2)——垃圾回收
![1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation](/img/1a/162b060a6498e58278b6ca50e4953c.png)
1180: fractional line delimitation /p1068 [noip2009 popularization group] fractional line delimitation

new URL(“www.jjj.com“)

1182:合影效果

虛擬機14安裝win7(圖教程)

Basic knowledge of hard disk (head, track, sector, cylinder)

HDI blind hole design, have you noticed this detail?

Valentine's Day - VBS learning (sentences, love words)
![[ybtoj advanced training guidance] class roll call [string hash]](/img/5b/bbf8fa51d180b50fbbee4bcc278c70.jpg)
[ybtoj advanced training guidance] class roll call [string hash]

This article explains in detail the difficult problems and solutions faced by 3D cameras
随机推荐
手机号、邮箱正则验证[通俗易懂]
1180:分数线划定/P1068 [NOIP2009 普及组] 分数线划定
2020-10-27
硬盘基本知识(磁头、磁道、扇区、柱面)
Decision table method for basic content learning of software testing (2)
满电出发加速品牌焕新,长安电动电气化产品吹响“集结号”
Test cases for learning the basic content of software testing (II)
Edit the live broadcast source code with me. How to write the live broadcast app code
Ingersoll Rand面板维修IR英格索兰微电脑控制器维修XE-145M
Bron filter Course Research Report
Abnormal occurrence and solution
JVM family (2) - garbage collection
01-分布式系统概述
1182:合影效果
Comprehensive evaluation of outline note taking software workflow: advantages, disadvantages and evaluation
Explain final, finally, and finalize
玩玩sftp上传文件
创建多线程的方法---1创建Thread类的子类及多线程原理
优秀笔记软件盘点:好看且强大的可视化笔记软件、知识图谱工具Heptabase、氢图、Walling、Reflect、InfraNodus、TiddlyWiki
A classic JVM class loaded interview question class singleton{static singleton instance = new singleton(); private singleton() {}