Pregunta de entrevista de Flight Network

question from coding, data structure