Solutions to programming questions from Cracking the Code Interview