JLR interview question

In Tray exercise