Amadeus interview question

I cannot say, but, leetcode medium.