Two Sigma interview question

Two OA Hackerrank questions, one hard one medium