Pregunta de entrevista de WorldQuant

Asked an easy HackerRank problem