Solutions to various programming puzzles