Celerative interview question

A codility exercise that's relevant to the position