ClimbingStairs(leetcode)
来源:互联网 发布:jamp软件的作用 编辑:程序博客网 时间:2024/06/04 18:20
题目:
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 static int climbStairs(int n) { if(n<=3) { return n; } int []dp=new int [n+1]; dp[1]=1; dp[2]=2; for(int i=3;i<n+1;i++) { dp[i]=dp[i-1]+dp[i-2]; } return dp[n];}
阅读全文
0 0
- LeetCode - ClimbingStairs
- ClimbingStairs(leetcode)
- LeetCode No.70 ClimbingStairs
- Java-LeetCode-ClimbingStairs
- 【LeetCode从零单排】No70.ClimbingStairs
- Lintcode111 ClimbingStairs solution 题解
- leetcode
- [leetcode]
- LeetCode
- leetcode
- leetcode
- leetcode:
- leetcode:
- LeetCode
- leetcode
- LEETCODE
- leetcode
- leetCode
- oracle 与 SQL server区别 实例 数据库 表空间
- redis持久化RDB和AOF
- 乐享其约CEO施建锋:微信预约时代的到来
- Spring_SSH整合之_架构的历史(四层架构整合JSP+MySQL+JavaBean+Hibernate+Dao+Impl)_4
- Android 计步传感器的实现
- ClimbingStairs(leetcode)
- sdut-离散题目7
- 数字图像处理实验(10):PROJECT 05-01 [Multiple Uses],Noise Generators
- SpringMVC学习笔记(二):基于注解的方式
- mybatis update某一个字段
- mysql打开远程连接
- Ubuntu 16.04 LTS (LEMP) 安装 Nginx/PHP 7/MySQL 5.7
- 高性能Javascript--脚本的无阻塞加载策略
- springMVC-笔记011-多个拦截器