Preamble:
When asking the staircase problem the usual given array of allowable paces is [1,2,3]
See lots of examples of the same problem on SO such as n-steps-with-1-2-or-3-steps-taken-how-many-ways-to-get-to-the-top
My question relates to this but on finding proof for cases where the allowed paces includes negative and zero.
Somethings are obvious such as
- if all the step sizes are positive then the number of possible ways is finite and solvable.
- if any step size is zero then then the number of possible ways becomes infinite.
- If at least one negative step size is allowed AND any combination of step sizes sum to zero then the number of possible ways becomes infinite.
Examples:
countSteps(stairSize:=5, [ 1,2,3]) // 17
countSteps(stairSize:=5, [0,1,2,3]) // 17...
countSteps(stairSize:=5, [-2,-1 ]) // zero ways
countSteps(stairSize:=5, [-2,-1,0]) // infinitely zero ways
countSteps(stairSize:=5, [2,4]) // zero ways
countSteps(stairSize:=5, [ 3]) // zero ways
countSteps(stairSize:=5, [-1,3]) // infinite ways
countSteps(stairSize:=5, [6,7,8]) // zero ways
Question:
? Can you determine whether given
a stair size (1.. for now)
and an array of allowable steps
is the result find-able ?