Solutions to codility problems