Example 1
Input
n = 2
Output
2
Loading CodeSprint...
/problems/climbing-stairs
A staircase has n steps. Each move may climb either one or two steps. Return the number of distinct move sequences that reach the top.
Implement this function and return the result. CodeSprint supplies each test case automatically.
climbStairs(n) → numberInput
n = 2
Output
2
Input
n = 5
Output
8
Constraints
1 <= n <= 45