Two Sigma interview question

HackerRank-style problems.