leetcode 70. Climbing Stairs
来源:互联网 发布:人工智能的利弊英语 编辑:程序博客网 时间:2024/05/17 05:53
70. Climbing Stairs
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?
Note: Given n will be a positive integer.
Example 1:
Input: 2Output: 2Explanation: There are two ways to climb to the top.1. 1 step + 1 step2. 2 steps
Example 2:
Input: 3Output: 3Explanation: There are three ways to climb to the top.1. 1 step + 1 step + 1 step2. 1 step + 2 steps3. 2 steps + 1 step
标准线性动态规划
class Solution {public: int climbStairs(int n) { vector<int> a(n+1, 1); for (int i = 2; i <= n; i++) a[i] = a[i-1] + a[i-2]; return a[n]; }};
阅读全文
0 0
- [LeetCode]70.Climbing Stairs
- LeetCode --- 70. Climbing Stairs
- [Leetcode] 70. Climbing Stairs
- [leetcode] 70.Climbing Stairs
- [leetCode]70. Climbing Stairs
- 70. Climbing Stairs LeetCode
- [LeetCode]70. Climbing Stairs
- 【LeetCode】70. Climbing Stairs
- leetcode 70. Climbing Stairs
- leetcode 70. Climbing Stairs
- LeetCode *** 70. Climbing Stairs
- 【LeetCode】70. Climbing Stairs
- LeetCode 70. Climbing Stairs
- leetcode 70. Climbing Stairs
- [LeetCode]70. Climbing Stairs
- 【LeetCode】70. Climbing Stairs
- LeetCode 70. Climbing Stairs
- #leetcode#70.Climbing Stairs
- 子父类中构造函数
- android 时间,日期,各种不同显示的格式化工具
- Hybris-Installing the Accelerator Extension Set
- 马化腾公开信:AI将成为基础设施,腾讯要打造“数字生态共同体”
- 如何才能发挥大数据的价值?
- leetcode 70. Climbing Stairs
- 关于混合app 开发框架Ionic
- CNN中的权值共享理解
- C #7.0 Pocket Reference.pdf 英文原版 免费下载
- 首发丨极课大数据完成1亿元B轮融资,用AI提升学生作业、考试管理效率
- 论递归回溯的一些基本优化
- “双11”即将来袭,阿里巴巴选择这家服务商为交易保驾护航
- matlab计算任意多边形面积
- 关于android中移植wireless tool