Pregunta de entrevista de Vodafone

How would you solve this problem?