public class Solution {

public int climbStairs(int n) {

int [] sum = new int[n + 1];

if(n < 2) {

return 1;

}

sum[0] = 1;

sum[1] = 1;

sum[2] = 1;

```
for(int i = 2; i< sum.length; i++) {
sum[i] = sum[i - 1] + sum[i - 2];
}
return sum[n];
}
```

}