My codility challenge