Domanda di colloquio di RouteOne

How would you solve this code challenge?