More answers for chapter 1 of Cracking the Coding Interview Questions