Algorithm · Uber · Medium
Problem: Minimum-step reachability with limited moves You are given a non-negative integer n. Beginning at position 0 on a number line, determine the fewest moves needed to arrive exactly at position n. From a current position i, each move must be one of the following: Step backward by 1 to i - 1, provided that i - 1 >= 0. Jump forward by a value p, where p is prime and the decimal form of p contains the digit 3—for example, 3, 13, 23, 31, 43, .... The destination is i + p,…
Checking your access…