It’s a subtle issue, but, I’m assuming (“hoping”) that the question is not trying to ask for carriers that operate in both directions, but carriers that operate in “either” direction.
After playing with possible answers, I think (again: “hope”) I properly determined that the data doesn’t support an interpretation that the carrier must have flights on both legs of JFK to LHR and LHR to JFK.
text from question:
“Problem: Using the air_alliances and air_routes collections, find which alliance has the most unique carriers(airlines) operating between the airports JFK and LHR , in both directions.”
If I’m correct, the question would be better worded as “…operating between the airports JFK and LHR, in either direction.”