70. Climbing Stairs
来源:互联网 发布:淘宝whoo小样是真的吗 编辑:程序博客网 时间:2024/06/05 16:46
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?
public class Solution { public int climbStairs(int n) { if (n == 0 || n == 1) return 1; int pre = 1; int current = 1; for (int i = 2; i <= n; i++) { int temp = current + pre; pre = current; current = temp; } return current; }}
0 0
- [LeetCode]70.Climbing Stairs
- 70.Climbing Stairs
- LeetCode --- 70. Climbing Stairs
- [Leetcode] 70. Climbing Stairs
- [leetcode] 70.Climbing Stairs
- 70.Climbing Stairs
- 70. Climbing Stairs
- 70.Climbing Stairs
- 70. Climbing Stairs
- [leetCode]70. Climbing Stairs
- 70. Climbing Stairs
- 70. Climbing Stairs LeetCode
- 70. Climbing Stairs
- 70. Climbing Stairs
- 70. Climbing Stairs
- [LeetCode]70. Climbing Stairs
- 【LeetCode】70. Climbing Stairs
- 70. Climbing Stairs
- 67. Add Binary
- Java中的String
- 欢迎使用CSDN-markdown编辑器
- C/C++头文件一览
- 【poj 2976】 Dropping tests 二分(分数优化)
- 70. Climbing Stairs
- eclipse 断点进不去 显示 source not found
- LambdaMART的思想
- [PKU 3046] Ant Counting (计数DP+差分加数)
- Java中有关Null的9件事
- Android-AndFix 热修复框架原理及源码解析
- ie下无法解析trim()
- 使用boost库时,遇到如下问题
- java学习