Squarepoint Capital Interview Question

Code problem about sorted lists