Algorithm · Uber · Medium
You start at step 0 of a staircase and need to land exactly on step n. On each move, you may advance by: exactly 1 step, or a number of steps equal to any prime whose decimal form ends in the digit 3 (such as 3, 13, 23, or 43). A jump may never take you past step n. Count how many ordered sequences of jumps bring you from step 0 to step n. Since this count can be huge, return it modulo 1,000,000,007. A dynamic programming solution is expected. Example 1: Explanation: The…
Checking your access…