Solutions to codility.com problems