Squarepoint Capital interview question

Solve a Hakerank programming problem