Two Sigma interview question

I believe it is a lc hard problem.