Loading...
Loading...
Loading...
A hall has n stairs. A visitor climbs one, two or three stairs at a time. Print the number of different ways to reach the top.
Example 1
Input
4
Output
7
The ways are 1111, 112, 121, 211, 22, 13 and 31.
Example 2
Input
3
Output
4
Try the problem first. Open one hint at a time.
Add the ways for n - 1, n - 2 and n - 3.
The ways to stand on the ground, step 0, is 1.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor