Two Sigma interview question

One simple algorithmic question