Amadeus interview question

Simple DSA question Leetcode easy to medium