Skip to content

Commit ec7e029

Browse files
committed
Create #70. Climbing Stairs.cpp
1 parent 6e75c0b commit ec7e029

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

#70. Climbing Stairs.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
int climbStairs(int n) {
4+
vector<int> dp(n+1);
5+
dp[0]=1;
6+
dp[1]=1;
7+
for(int i=2;i<=n;i++){
8+
dp[i]=dp[i-1]+dp[i-2];
9+
}
10+
return dp[n];
11+
}
12+
};

0 commit comments

Comments
 (0)