Add method from cracking the coding interview