Two Sigma interview question

Solve hackerrank questions through their long