leetcode-Climbing Stairs
2015-11-04 22:19
411 查看
菲波那切数列。
public class Solution { public int climbStairs(int n) { int cur=0; if(n==0||n==1) return 1; int pre1=1; int pre2=1; for(int i=2;i<=n;i++) { cur=pre1+pre2; pre2=pre1; pre1=cur; } return cur; } }
相关文章推荐
- Train Problem I
- Mail搭建
- leetcode-Contains Duplicate II
- Drainage Ditches(最大流)
- LightOJ 1236 Pairs Forming LCM (LCM 唯一分解定理 + 素数筛选)
- saiku - JCR在saiku中的运用原理
- git main branch 提交远程仓库失败
- 使用AIDL实现进程间通信
- Daily Scrumming* 2015.11.4(Day 16)
- process launch failed: Security
- 实战阿里云-实战Fail2Ban之v0.9.3
- 使用mail命令发邮件
- maven3+项目管理命令总结 (错误解决:Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2)
- linux系统监控、诊断工具摘录top IO wait lsof
- httpclient提示Cookie rejected: violates RFC 2109: domain must start with a dot
- 人工智能研究
- Daily Scrum (2015/11/3)
- 多线程wait()和sleep()以及InterruptedException异常
- 1014. Waiting in Line (30)
- 1014. Waiting in Line (30)