Amadeus interview question

2 Puzzles , basic dsa , core subjects