Domanda di colloquio di Apple

How would you code a solution