Amadeus interview question

Solving some problems on Hacker rank