class Solution {
public:int climbStairs(int n) {if (n == 1)return 1;int first = 1;int second = 2;for(int i = 3; i < n+1; i++){int third = first + second;first = second;second = third;}return second;}
};

转载于:https://www.cnblogs.com/smallredness/p/10675639.html

70.Climbing Stairs相关推荐

  1. 70. Climbing Stairs

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

  2. 【斐波那切数列】LeetCode 70. Climbing Stairs

    LeetCode 70. Climbing Stairs 这是一道利用斐波那切数列求解的题目.求斐波那切数列有比较经典的4种方法 (1)递归法:复杂度太高 (2)迭代法:时间复杂度为O(n)O(n)O ...

  3. [勇者闯LeetCode] 70. Climbing Stairs

    [勇者闯LeetCode] 70. Climbing Stairs Description You are climbing a stair case. It takes n steps to rea ...

  4. [LeetCode]70.Climbing Stairs

    [题目] You are climbing a stair case. It takes n steps to reach to the top. Each time you can either c ...

  5. 【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 ...

  6. Leet Code OJ 70. Climbing Stairs [Difficulty: Easy]

    题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either cl ...

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

  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

    Problem Definition: You are climbing a stair case. It takes n steps to reach to the top. Each time y ...

  10. leetcode python3 简单题70. Climbing Stairs

    1.编辑器 我使用的是win10+vscode+leetcode+python3 环境配置参见我的博客: 链接 2.第七十题 (1)题目 英文: You are climbing a stair ca ...

最新文章

  1. 微型计算机系统结构的五大基本组成部件,连接计算机系统结构的五大基本组成部件...
  2. 终于要揭开神秘面纱?Magic Leap将要展示产品
  3. python3数据库编程_python3+PyQt5 数据库编程--增删改实例
  4. wuhan2020:武汉新型冠状病毒防疫开源信息收集平台
  5. Java引用类型有哪些
  6. 异常检测算法之IForest
  7. 利用Python爬虫采集mac电脑皮肤
  8. 计算机二级python什么水平_计算机二级python好过吗 通过率是多少
  9. 2018 OpenInfra Days China官方盛典邀您莅临!文末有福利!
  10. Falsy Bouncer|FreeCodeCamp
  11. RabbitMQ安装+配置远程访问+集群(windows)
  12. 软件测试:什么样的公司需要专职测试?
  13. wannier拟合能带总是拟合不上_中科大PRL:面内磁化的本征量子反常霍尔效应:搜索规则和材料预测...
  14. proteus常用元件图示和名称介绍
  15. CSS animation-play-state用法
  16. 惠普linux进入bios设置u盘启动,hp惠普笔记本进入bios设置u盘启动装系统的方法步骤详细教程 - 系统家园...
  17. html模拟手机页面
  18. 百济神州的商业化故事讲到哪一章?
  19. 安全智能分析技术白皮书
  20. JavaScript中数据类型的转换与undefined及Null

热门文章

  1. 【顶】Asp无组件生成缩略图(1)
  2. docker入门与实践之【04-使用dockerfile定制镜像】
  3. Neo4j: 迁移MySQL的数据到Neo4j
  4. Java8-Stream-终止操作-查找与匹配
  5. [译]NectarJS:编译JavaScript为任意平台原生二进制代码
  6. SVG 基础知识 回顾
  7. 8字箴言:尊重、尽责、开放、创新
  8. 241. Different Ways to Add Parentheses
  9. 关系数据库的查询建表
  10. 手把手教您如何识别翻新机子