Codility problem