Algorithm · Uber · Medium
A lock configuration is represented by a length-L string, where every position contains a digit from 0 through 9. Beginning at start, determine how to arrive at target. For each move, select one position i and turn its digit by one in either direction. Turning upward changes 9 into 0, while turning downward changes 0 into 9. Certain configurations appear in deadends; once the lock reaches any such configuration, no further moves are allowed. Find the fewest moves required to…
Checking your access…