简单的动态规划问题:
class Solution {
public:
int climbStairs(int n) {
vector<int> stairs(n,0);
stairs[0] = 1;
stairs[1] = 2;
for (int index=2;index<stairs.size();index++){
stairs[index] = stairs[index-1]+ stairs[index-2];
}
return stairs[n-1];
}
};