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?

Subscribe to see which companies asked this question

///////////233333333一看题有点动态规划和组合的概念

///////////斐波那契数列

 class Solution {
public:
int climbStairs(int n) {
if(n<=)
return ;
int p[n];
p[]=;
p[]=;
p[]=;
for(int i=;i<=n;i++)
p[i]=p[i-]+p[i-];
return p[n];
}
};

70. Climbing Stairs Add to List的更多相关文章

  1. 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 ...

  2. Leetcode#70. Climbing Stairs(爬楼梯)

    题目描述 假设你正在爬楼梯.需要 n 阶你才能到达楼顶. 每次你可以爬 1 或 2 个台阶.你有多少种不同的方法可以爬到楼顶呢? 注意:给定 n 是一个正整数. 示例 1: 输入: 2 输出: 2 解 ...

  3. 377. Combination Sum IV 70. Climbing Stairs

    back function (return number) remember the structure class Solution { int res = 0; //List<List< ...

  4. 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 ...

  5. Leetcode之70. Climbing Stairs Easy

    Leetcode 70 Climbing Stairs Easy https://leetcode.com/problems/climbing-stairs/ You are climbing a s ...

  6. 刷题70. Climbing Stairs

    一.题目说明 题目70. Climbing Stairs,爬台阶(楼梯),一次可以爬1.2个台阶,n层的台阶有几种爬法.难度是Easy! 二.我的解答 类似的题目做过,问题就变得非常简单.首先用递归方 ...

  7. LeetCode练题——70. Climbing Stairs

    1.题目 70. Climbing Stairs——Easy You are climbing a stair case. It takes n steps to reach to the top. ...

  8. [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 ...

  9. leetCode 70.Climbing Stairs (爬楼梯) 解题思路和方法

    Climbing Stairs  You are climbing a stair case. It takes n steps to reach to the top. Each time you ...

随机推荐

  1. Web Deploy 安装及问题解决

    注意: 站点名称:  服务器上IIS的站点名称.  . 我之前这里随便写一直不成功. 返回500..... 用户名, 密码:  这里最好用windows帐号. 问题比较少. 目标URL: 可不写. 可 ...

  2. 爬虫学习笔记(2)--创建scrapy项目&&css选择器

    一.手动创建scrapy项目---------------- 安装scrapy: pip install -i https://pypi.douban.com/simple/  scrapy    1 ...

  3. windows安装mysql教程2017最新

    1.首先在mysql官网下载最新版mysql, 附上链接点击打开链接,根据你的系统型号选择对应的包下载,大约300多兆,版本号为5.7.19 下载完之后,解压缩,是一个标准的mysql文件 2.第二步 ...

  4. 生成sql表结构

    DataConstruct.php <?php /** * Created by PhpStorm. * User: Administrator * Date: 2017/7/21 * Time ...

  5. 手机端的META差异

    手机端的META你了解多少? 我们先来简单了解下meta标签:meta指元素可提供有关页面的元信息(meta-information),比如针对搜索引擎和更新频度的描述和关键词. 标签位于文档的头部, ...

  6. ggplot2学习总结

  7. uCOS-II的学习笔记(共九期)和例子(共六个)

    源:uCOS-II的学习笔记(共九期)和例子(共六个) 第一篇 :学习UCOS前的准备工作http://blog.sina.com.cn/s/blog_98ee3a930100w0eu.html 第二 ...

  8. VMware VIC

    vSphere Integrated Containers - a short intro High-Level view of VCH Networking vSphere Integrated C ...

  9. 关于 kinect 的开发

    1. 参考开发博客:http://www.cnblogs.com/yangecnu/p/Learning-KinectSDK.html

  10. MyEclipse Could not create the view: An unexpected exception was thrown解决方案

    问题:电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected excep ...