Climbing Stairs
Problem statement
A staircase has n steps. Each move climbs either one or two steps. Return the number of ordered move sequences that reach the top exactly.
For zero steps, count the empty sequence as one way.
Function
climbStairs(n: int) → intExamples
Example 1
n = 2return = 2The two sequences are [1,1] and [2].
Example 2
n = 3return = 3The three sequences are [1,1,1], [1,2] and [2,1].
Constraints
0 <= n <= 45.