Pergunta de entrevista da empresa Two Sigma

coding challenge with three questions on Hackerrank, with one question optional