For the purpose of this question, the phrases “airport route” and “airort connection” are used interchangeably. You’re given a list of

For the purpose of this question, the phrases “airport route” and “airort connection” are used interchangeably.

You’re given a list of airports (three-letter-codes like “JFK”), a list of routes (one-way flights from one airport toanother like
[“JFK”, “SFO”), and a string airport.
Write a function that returns the minimum number of airport connections(one-way flights) that need to be added in order
for someone to be able to reach any airport in the list, startng at the starting airpot.
Note that route [“JFK”, “SFO”] only allows you to fly form “JFK” to “SFO”.
Use: Python, C or C++
routes = [[“DSM”, “ORD”], [“ORD”, “BGI”], [“BGI”, “LGA”], [“SIN”, “CDG”], [“CDG”, “SIN”],
[“CDG”, “BUD”], [“DEL”, “DOH”], [“DEL”, “CDG”], [“TLV”, “DEL”], [“EWR”, “HND”],
[“HND”, “ICN”], [“HND”, “JFK”], [“ICN”, “JFK”], [“JFK”, “LGA”], [“EYW”, “LHR”],
[“LHR”, “SFO”], [“SFO”, “SAN”], [“SFO”, “DSM”], [“SAN”, “EYW”], [“LGA”, “EYW”]]
Source = “LGA”

Leave a Reply

Your email address will not be published. Required fields are marked *