Back to problems

Find Shortest Path for All Items

Algorithm · Coinbase · Hard

A restaurant menu lists several dishes, with each dish assigned a coordinate on a plane. Create an algorithm that determines the minimum-length route that reaches every dish location. Measure a route by the sum of the distances between its coordinates. Do not treat the locations as though they necessarily lie along one straight line. Return the minimum total route length when the trip begins at the origin (0,0). The input is formatted as [food item count, [point1], [point2],…

Checking your access…