The clients are not willing to consider flights within 241 kilometers (150 miles) of each other. Using distance.csv or distance_matrix.csv, determine the set of airports which cannot be flown to each other. For example, you cannot fly from John F. Kennedy International Airport (JFK) to Philadelphia International Airport (PHL) because they are 150 kilometers apart.
If my calculations are correct, only 836 flights out of 900 are legal.
Group Questions
Should legal/illegal flights be hardcoded or calculated dynamically? Recalculating for each possible flight seems redundant and can be easily implemented statically as a look-up table where the key is a 2-tuple of the airport IATA codes and the value is a boolean that is true if the flight is legal and false otherwise. Make sure to account for both orderings of the tuple (e.g. for airports A and B, map both of the tuples (A,B) and (B,A) so order does not matter).
Summary
The clients are not willing to consider flights within 241 kilometers (150 miles) of each other. Using
distance.csv
ordistance_matrix.csv
, determine the set of airports which cannot be flown to each other. For example, you cannot fly from John F. Kennedy International Airport (JFK) to Philadelphia International Airport (PHL) because they are 150 kilometers apart.If my calculations are correct, only 836 flights out of 900 are legal.
Group Questions
(A,B)
and(B,A)
so order does not matter).