Two Sigma Interview Question

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