cracking the coding interview solution chapter 4-12