Codility solutions.