Flight Network interview question

question from coding, data structure