70. Climbing Stairs (Array; DP)
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?
class Solution {
public:
int climbStairs(int n) {
int result[n+];
result[] = ;
result[] = ;
int i =;
while(i<=n)
{
result[i] = result[i-]+result[i-];
i++;
}
return result[n];
}
};
70. Climbing Stairs (Array; DP)的更多相关文章
- 377. Combination Sum IV 70. Climbing Stairs
back function (return number) remember the structure class Solution { int res = 0; //List<List< ...
- LN : leetcode 70 Climbing Stairs
lc 70 Climbing Stairs 70 Climbing Stairs You are climbing a stair case. It takes n steps to reach to ...
- 刷题70. Climbing Stairs
一.题目说明 题目70. Climbing Stairs,爬台阶(楼梯),一次可以爬1.2个台阶,n层的台阶有几种爬法.难度是Easy! 二.我的解答 类似的题目做过,问题就变得非常简单.首先用递归方 ...
- 42. leetcode 70. Climbing Stairs
70. Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top. Each time y ...
- Leetcode#70. Climbing Stairs(爬楼梯)
题目描述 假设你正在爬楼梯.需要 n 阶你才能到达楼顶. 每次你可以爬 1 或 2 个台阶.你有多少种不同的方法可以爬到楼顶呢? 注意:给定 n 是一个正整数. 示例 1: 输入: 2 输出: 2 解 ...
- Leetcode之70. Climbing Stairs Easy
Leetcode 70 Climbing Stairs Easy https://leetcode.com/problems/climbing-stairs/ You are climbing a s ...
- LeetCode练题——70. Climbing Stairs
1.题目 70. Climbing Stairs——Easy You are climbing a stair case. It takes n steps to reach to the top. ...
- [LeetCode] 70. Climbing Stairs 爬楼梯问题
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...
- [LeetCode] 70. Climbing Stairs 爬楼梯
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...
随机推荐
- Kong管理UI -kong-dashboard (附kong封装webservice方法)
本文仍然是在centos 6.7的环境下进行 本文转载请注明出处 —— xiaoEight btw如果要正常使用管理UI,前提为kong已经正常run(可参考)起来,此 ...
- https单向认证服务端发送到客户端到底会不会加密?
最近向大神请教了CA认证单向认证和双向认证的问题,有一点不太明白,单向认证的时候,为什么服务端发送到客户端的东西也是加密的?
- Unreal Engine 4 反射机制的实现
转自:http://blog.csdn.net/noahzuo/article/details/51482255 反射机制 反射机制指的是程序可以在运行期间进行检测和修改自己状态的能力. UE4引擎使 ...
- pandas的to_csv函数
分隔符 sep : Field delimiter for the output file (default ”,”) dt.to_csv('C:/Users/think/Desktop/Result ...
- Mybatis 测试延迟加载
在学习mybatis的延迟加载时,对 lazyLoadingEnabled 和 aggressiveLazyLoading 的区别并不理解,特别是对查询的条件不同时,执行的查询语句也不一样,所以还是测 ...
- ossim 4.1 安装
在这说明一下,本人也是第一次安装这东东很多我自己也不懂,只能把自己的安装步骤通过贴图呈现出来了!!!! 我用root用户登录的,顺便查看ip 在浏览器打开网址https://192.168.86.15 ...
- linux case ${variable} in
脚本实现划分考试等级层次;
- python入门-变量和简单数据类型
1 title() 是以首字母大写的方式显示每个单词 lower() 字母小写 upper() 字母大写 2 python使用+号来合并字符串 字符串中使用制表符用\t 字符串中使用换行符\n 用rs ...
- Jenkins + testNg + maven 项目持续集成
搞了一整天,梳理下关键点: 1.项目的pom.xml要配置插件,同时指定testng.xml文件的位置.就被这个卡了好久 <properties> <maven-surefire-p ...
- Find 和 Findstr
FIND 在文件中搜索文字字符串. FINDSTR 在文件中搜索字符串. findstr能用正则表达式,而find不能 dir c:|find /N /I /C "windows&q ...