Cracking The Coding Interview solution