Codility alpha 2010 solution