# 【Leetcode】之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?

## 二.我的解题思路

class Solution {
public:
int climbStairs(int n) {
vector<int> tmp(n+1,0);
tmp[0]=1;tmp[1]=1;
if(n<=0) return 0;
if(n<2) return tmp[n];
int cnt=2;
while(cnt<=n){
tmp[cnt]=tmp[cnt-1]+tmp[cnt-2];
cnt++;
}
return tmp[n];
}
};

#### LeetCode 70 Climbing Stairs(Python详解及实现)

2017-08-05 12:56:00

#### LeetCode Climbing Stairs 递归求解和动态规划法

2013-12-21 08:13:57

#### leetcode之70. Climbing Stairs(C++解法 动态规划思想)

2016-09-21 15:19:49

#### LeetCode（70） Climbing Stairs

2015-08-19 21:54:20

#### Leetcode 746. Min Cost Climbing Stairs

2017-12-20 16:57:52

#### LeetCode 746. Min Cost Climbing Stairs

2017-12-21 11:33:54

#### leetcode笔记：Climbing Stairs（斐波那契数列问题）

2015-09-16 00:20:58

#### LeetCode | Climbing Stairs

2013-09-19 23:35:32

#### 【LeetCode】746.Min_Cost_Climbing_Stairs

2017-12-18 20:00:18

#### LeetCode 70 — Climbing Stairs（C++ Java Python）

2014-03-20 22:17:03