class Solution {
public:
int climbStairs(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
if (n == 2) return 2;
int resNMinus1 = 2,resNMinus2=1,resN;
for (int i = 3; i <= n; ++i) {
resN = resNMinus1 + resNMinus2;
resNMinus2 = resNMinus1;
resNMinus1 = resN;
}
return resN;
}
};