Domanda di colloquio di Postindustria

Solve difficult problem more related to math than programming.