Three Step Stairs
A child climbs a staircase of n steps and can take 1, 2 or 3 steps at a time. Return how many different sequences of moves reach exactly step n. (For n = 0 there is one way: do nothing.)
Example 1
n 4
returns 7
7 ways.
Constraints
0 <= n <= 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Dynamic programming problems
- Tiling a Two by N StripEasy
- Token Orders at the TurnstileEasy
- Two-Lane RoadEasy
- Best Stretch SumMedium
- Cheapest DescentMedium
- Cheapest Pool PassesMedium
- Coins From Either EndMedium
- Count DerangementsMedium