My solution for Codility exercises