Climbing stairs
Easydynamic programmingmath
A staircase has n steps and each move climbs one or two. Return the number of distinct ways to reach the top.
Example 1
Input: n = 2 Output: 2
1+1 or 2.
Example 2
Input: n = 3 Output: 3
1+1+1, 1+2, 2+1.
Constraints
- 1 ≤ n ≤ 45
Submit checks your solution against 8 tests, including hidden ones.
/**
* @param {int} n
* @return {int}
*/
function climbStairs(n) {
}