ludus

Traveling Salesman

ld-0017 · 9 › █████████░ · graphs, algorithms · requires: arrays, lambda, algorithmic · oner generalized golfed

Your client runs same-day deliveries. Each morning the van leaves the depot, visits every client location exactly once, and returns to the depot. The city is full of one-way streets, so travel times are asymmetric: the table gives minutes from the row's location to the column's location, and A-to-B rarely equals B-to-A.

The depot is the first row. Produce the fastest full route as a list of location names, one per row of OUTPUT: the depot, every location in visiting order, and the depot again at the end. There is always exactly one fastest route. Up to seven locations total.

Work on it

  1. Make a copy of the template — it becomes your private sheet.
  2. Solve it however you like — helper columns and extra tabs are fair game. The one rule: the grader swaps INPUT for other datasets, so never put your own content inside INPUT.
  3. Check yourself against the expected sample output shown in your copy (and below).
  4. Submit below — Share → "anyone with the link, Viewer", paste the link. Your sheet is graded against 3 hidden datasets, so hardcoded answers won't survive.

Sample

Input (Input!B2:I9)

DepotMillQuarryBridgeHarbor
Depot37402393
Mill47406288
Quarry3745388
Bridge80877226
Harbor68198627

Expected output (Answer!B3:B10)

Route
Depot
Bridge
Harbor
Mill
Quarry
Depot