Pregunta de entrevista de Bloomberg

The coding question was not hard.