There is a known problem, so I quote it here
A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. How many possible ways the child can run up the stairs?
I have two questions here:
- How do I get an exact formula to calculate exact number for any
iwithout writing a simulation? - How can this formula be generalized for any
kinstead of just3?
My math knowledge in dynamic programming is limiting me to "write a recursion, use memoization to cache results and see what simulation shows" but I'm not able to deduce a general formula to just put numbers and get out the result.