AlgoViz
← All drills
🧠 Drill · Think it through

The cheapest flight home

The problem

You have a map of cities connected by flights, and each flight has its own price. Starting from your city, find the cheapest total price to reach your home city. Each flight has a different cost, and you want the lowest total cost, not the fewest flights.

Don't jump to code. Walk the four questions an expert asks first — you'll build the habit, not just the answer.

1

Restate it

Before anything else — did you read what's actually being asked? Strip the story to the bare goal.

Strip away the story. What are we minimizing?