WorldQuant interview question

Asked an easy HackerRank problem