The code from the Book Cracking the Coding Interview: 150 Programming Questions and Solutions