Domanda di colloquio di Swiss Re

Can you solve the following coding problem?