All these questions are available in internet and I have used Cracking the Coding Interview as reference for few questions. But the implementation might differ from the actual book as only questions are inspired from the books. Please suggest if there could be any better algorithms for the questions with better run time.