Amadeus interview question

Debugging a code in hackerrank.