Lessons
C++ · Algorithm Techniques · 45. One-dimensional DP

step 1 of 7

Climbing the stairs

I climb 1 or 2 stairs at a time. To stand on stair i, I came from i - 1 or from i - 2.

So the ways add up. One row of boxes, filled left to right.

Mission

How many ways up 10 stairs? Change n and RUN.

PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
← press me!
readyscreen

Press RUN to see what this program does.

Do the mission and Next turns green.

One-dimensional DP