๐ซ The Airport With the Most Traffic
You're working as a data analyst for a major aviation authority, and you need to identify which airports handle the most flight traffic. Given a database table containing flight route information, your task is to find the airport(s) with the highest total traffic.
The Problem: Calculate the total number of flights for each airport by counting both departing and arriving flights. An airport's traffic score is the sum of all flights that either departed from or arrived at that specific airport.
Input: A Flights table with three columns:
departure_airport(int): ID of the departure airportarrival_airport(int): ID of the arrival airportflights_count(int): Number of flights on this route
Output: Return the airport ID(s) with the maximum total traffic. If multiple airports tie for the highest traffic, return all of them.
Key Insight: Each flight route contributes to the traffic count of two airports - the departure airport and the arrival airport!
Input & Output
Constraints
- 1 โค Number of rows in Flights โค 104
- 1 โค departure_airport, arrival_airport โค 103
- 1 โค flights_count โค 104
- departure_airport โ arrival_airport (no self-loops)
- The combination (departure_airport, arrival_airport) is unique for each row