SimpleO(n) DP Approach in CPP


#1
int Solution::climbStairs(int A) {
vector<int> v(A+1);
v[0]=1;
v[1]=1;
for(int i=2;i<=A;i++){
    v[i]=v[i-1]+v[i-2];
}
return v[A];}