Pergunta de entrevista da empresa Microsoft

How would you solve this problem.