leetcode 70 Climbing Stairs(难易度:Easy)
来源:互联网 发布:云计算 云服务 编辑:程序博客网 时间:2024/05/29 14:31
Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
代码:int climbStairs(int n) { if(n == 0 || n == 1 || n == 2) return n; int a = 2; int b = 1; int res = 0; for(int i = 3; i <= n; i++) { res = a + b; b = a; a = res; } return res;}
原题地址:https://leetcode.com/problems/climbing-stairs/
0 0
- leetcode 70 Climbing Stairs(难易度:Easy)
- leetcode 070 Climbing Stairs(难易度:Easy)
- [Leetcode 70, easy] Climbing Stairs
- 【LeetCode】(70)Climbing Stairs (Easy)
- Leetcode #70 - Climbing Stairs - Easy
- 【Leetcode-Easy-70】Climbing Stairs
- LeetCode-70-Climbing Stairs(动态规划)-Easy
- Leetcode OJ 70 Climbing Stairs [Easy]
- [leetcode][easy]70. Climbing Stairs
- (Leetcode)70.Climbing Stairs(easy)
- LeetCode 70. Climbing Stairs (Easy)
- Easy 17 Climbing Stairs(70)
- LeetCode(70) Climbing Stairs
- LeetCode(70) Climbing Stairs
- <LeetCode><Easy> 70 Climbing Stairs #斐波那契数列
- 70. Climbing Stairs(Easy)
- LeetCode(70)Climbing Stairs
- leetcode 70-Climbing Stairs
- 数据结构实践——顺序表应用
- UVA12545 Bits Equalizer(脑洞)
- 如何查看Undo和Temp表空间中的会话
- 关于eclipse(64位)下aptana插件安装报错问题解决
- MapReduce的容错机制
- leetcode 70 Climbing Stairs(难易度:Easy)
- 9月风怒(2)
- 如何监控Expdp/Impdp会话进度
- Gradle--第六章、基本构建脚本2
- System.exit(0)和System.exit(1)区别
- [人月神话]读书笔记9--再论没有银弹("No Silver Bullet Refired")
- js setTimeout 和 setInterval实现多线
- gethostbyaddr ip到名字,gethostbyname名字到ip依赖于hosts、DNS服务器
- pic