Solution to the s-99 problems (http://aperiodic.net/phil/scala/s-99)