Cheapest Flights
You and a few friends are planning a holiday and want to spend as little money on flights as possible. You've gathered data on every flight available: where it departs, where it lands, and what it costs. Flights are one-way — a listed flight cannot be flown in reverse. The same pair of airports may be listed more than once at different prices.
Given the source and destination airports, produce the cheapest possible route as a list of airports in visiting order, one per row, starting with the source and ending with the destination. There is always exactly one cheapest route.
Work on it
- Make a copy of the template — it becomes your private sheet.
- Solve it however you like — helper columns and extra tabs are fair game. The one rule:
the grader swaps
INPUTfor other datasets, so never put your own content insideINPUT. - Check yourself against the expected sample output shown in your copy (and below).
- 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:F22)
| From | To | Cost | Source | |
| HND | SFO | 450 | HND | |
| HND | SEA | 400 | Destination | |
| HND | JFK | 1400 | JFK | |
| SFO | DEN | 200 | ||
| SEA | DEN | 300 | ||
| SFO | ORD | 500 | ||
| DEN | ORD | 150 | ||
| ORD | JFK | 180 | ||
| DEN | JFK | 400 | ||
| SEA | JFK | 900 |
Expected output (Answer!B3:B22)
| Route |
|---|
| HND |
| SFO |
| DEN |
| ORD |
| JFK |
Adapted from "Cheapest Flights" in the astral.cafe Community Practice Problems sheet.