Two Sigma Interview Question

Two OA Hackerrank questions, one hard one medium