Pregunta de entrevista de McKinsey & Company

algorithm question, all not hard