FunctionRacerProblemsRace

Three Step Stairs

EasyDynamic programmingPython, JavaScript, TypeScript, Java, C++

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Dynamic programming problems