Amadeus Interview Question

I cannot say, but, leetcode medium.