Winton Group interview question

Please complete the codility task