Solutions for codility problems