Swiss Re interview question

Can you solve the following coding problem?