CT046

Staircase Climb Ways

EasyAcceptance: 0.0%

There exists a staircase with n steps which you can climb 1 or 2 steps at a time. Given n, return the number of unique ways you can climb the staircase. The order of steps matters. Follow-up: what if you could climb any number from a set of positive integers X?

Example 1:

Input: 4 2 1 2
Output: 5

Example 2:

Input: 5 3 1 3 5
Output: 5

Constraints:

1 <= n <= 100 1 <= X[i] <= n

Tags:

dynamic-programming recursion
Loading...
Test Cases:No test cases
No test cases available.