My solution for Cracking the Coding Interview