Two Sigma interview question

Basic algorithm questions