class Solution {
public:
int climbStairs(int n) {
vector<int> table;
table.push_back(0);
table.push_back(1);
table.push_back(2);
if(n<=2)
return table[n];
for(int i=3;i<=n;i++)
{
table.push_back(table[i-1]+table[i-2]);
}
return table[n];
}
};
原文地址:http://blog.csdn.net/majing19921103/article/details/44859939