Squarepoint Capital interview question

Code problem about sorted lists