Back to problems

Shortest Path to Collect All Coins

Algorithm · Weride · Medium

Problem A 100×100 grid contains exactly 10 coins, with no cell holding more than one coin. Given a starting cell, find and return a shortest path that visits every coin. Movement is restricted to horizontal and vertical steps, and the path may pass through the same cell more than once. The route does not have a specified destination; it ends after the final coin has been collected. Aim for an implementation with good time complexity. Interface start is the starting grid…

Checking your access…