```cpp
class Solution {
public:
    int climbStairs(int n) {
        vector<int> dp = {0, 1, 2};
        dp.resize(n+1);
        for(int i=3;i<=n;i++){
            dp[i] = dp[i-1] + dp[i-2];
        }
        return dp[n];
    }
};
```
- O(n)
- dp



