We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
If you are having some trouble and want a hint without getting the answer from this dicussion:
Consider instead a 2 operation case (Davis can go up 1, or 2 steps at a time). In this case we see that all ways to n-2 result in the same total if the next op is 2. And all ways to n-1 result in the same total if the next op is 1.
From the n-2 stair, an op of 1 gets Davis to the n-1 stair, so it will be counted as an n-1 way.
There are various ways to code the solution. You do not need DP or recurrsion, but this is the most straight forward way.
Recursion: Davis' Staircase
You are viewing a single comment's thread. Return to all comments →
If you are having some trouble and want a hint without getting the answer from this dicussion:
There are various ways to code the solution. You do not need DP or recurrsion, but this is the most straight forward way.
Here is a good reference: http://ms.appliedprobability.org/data/files/Articles%2047/47-1-4.pdf