โ† All coding problems

Climbing stairs

HardDynamic programming

You climb a staircase of n steps taking 1 or 2 steps at a time. Return how many distinct ways reach the top (1 <= n <= 45).

Function
function solve(n)
Example 1
n = 3
โ†’ 3

Submit also runs 4 hidden tests, including edge cases.

console.log output is shown below