【DP】Climbing Stairs
来源:互联网 发布:c语言入门什么书好 编辑:程序博客网 时间:2024/05/22 13:58
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) { int one = 1; int two = 2; if(n == 1) return 1; else if(n == 2) return 2; for(int i=3; i<=n; i++){ int t = one + two; one = two; two = t; } return two; }}
0 0
- 【DP】Climbing Stairs
- 【Leetcode】Climbing Stairs (DP)
- LeetCode Climbing Stairs DP
- [leetcode][DP] Climbing Stairs
- DP------Climbing Stairs
- leetcode---climbing-stairs---dp
- Leetcode-Climbing Stairs(dp)
- Posts Tagged 【dp】Climbing Stairs
- DP——Climbing Stairs
- leetcode-70. Climbing Stairs(DP)
- LeetCode [DP]70. Climbing Stairs
- 70. Climbing Stairs (dp)
- leetcode70.[DP] Climbing Stairs My Submissions Question
- LeetCode-70-Climbing Stairs DP水题Fibonacci
- Climbing Stairs
- Climbing Stairs
- Climbing Stairs
- Climbing Stairs
- pig--- Use the Parallel Features
- 南阳 891 找点
- 我使用过的Linux命令之type - 显示命令的类型
- 常见Java面试题 – 第二部分:equals与==
- MVC中的使用捆绑和缩小(BundleConfig.RegisterBundles)
- 【DP】Climbing Stairs
- Leetcode-Evaluate Reverse Polish Notation-java
- 反射Reflect
- Linux设备驱动开发详解-Note(2)---设备驱动概述(2)
- Tiny210v2( S5PV210 )平台下创建基本根文件系统
- android ViewPager详解
- "0x00a1bdb3" 指令引用的 "0x00000001" 内存。该内存不能为 "read"。
- springMVC3学习(八)--全局的异常处理
- uva 11270 插头DP