Spoiler

```
int climbStairs(int n) {
if(n==1||n==2||n==0) return n;
int i=1,j=2,count=3;
int sum;
for(count;count<=n;count++){
sum=i+j;
i=j;
j=sum;
}
return sum;}
```

you can easy understand it with writed the way in five steps!

```
n | way
0 | 0
1 | 1
2 | 2
3 | 3
4 | 5
5 | 8
```

it meas that the way in n equals the sum of way in n-1 and n-2 ;

way(n)=way(n-1)+way(n-2);

if you got any ideas about my code please tell me .