Pregunta de entrevista de Leica Microsystems

During the technical test I was asked to write a small program to solve a problem.