Staircase climb ways

Write codeMedium18 min

Your task

Count the number of distinct ordered ways to climb exactly n stairs when each move advances by one of the allowed step sizes given in 'steps' (order matters; [1,2] and [2,1] are different). Return the count. 0 <= n <= 40, each step size in 1..n, steps are distinct.

Examples

count_step_ways(n: int, steps: list[int]) -> int
Example 1
Inputcount_step_ways(4, [1, 2])
Output5