Cracking the Coding Interview, Fourth Edition Paperback – Oct 15 2008
Customers Who Bought This Item Also Bought
No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.
Getting the download link through email is temporarily not available. Please check back later.
To get the free app, enter your mobile phone number.
What Other Items Do Customers Buy After Viewing This Item?
Most Helpful Customer Reviews on Amazon.com (beta)
This book is good in some ways. The best thing about it is the set of problems in it. It's quite comprehensive: every area I could think of is covered. Even the knowledge-based chapters (e.g., on threading, or networking, or low-level programming) are surprisingly up-to-date and representative of the type of stuff that is asked. So if you want to get a big list of problems and at least a good stab at the solutions (if you're stuck), it's much better to get this book (as opposed to looking for problems on the Internet).
So why only two stars? The biggest issue is that there are tons of errors in this book. I can't tell you how many, but I know I personally found at least 5. Some are trivial -- the book may say something is O(n) space, when it's O(1) space. Some are egregious -- the smart pointer implementation, which is compressed to one page in the solution section, is utterly broken. (For example, operator=() fails to give up ownership of what it points to before the assignment, before taking ownership of the new object. That is a completely wrong solution to the problem! What if an inexperienced reader reads this section and becomes confused?) Books like this should not have mistakes, especially not a 4th edition.
Sometimes the problem isn't clearly stated, so that trying to solve it is very difficult without more explanation. Flipping to the solution reveals what the problem was, but then what was the point?
In general, when reading this book, once gets the sense that it was thrown together. It seems like it wasn't edited in the most basic ways; for example, URLs are referred to as "urls" all over the text. That doesn't really matter, of course, but it is indicative of the type of publication it is. It's like someone wrote up an elaborate text file and then basically just sent it off to be published. Very cheap and kind of unprofessional.
Finally, the book's solutions (while usually 100% correct) typically don't try to explain and expose the thinking process behind a solution. True, sometimes it's quite obvious, so there's no point. But sometimes, it's not obvious -- it would be helpful to a potential interviewee to get a glimpse into HOW to get to the solution, instead of basically just being given the solution. This isn't always the case in the book, but most of the time it is.
So, there you go. If you want a nice collection of problems that's representative and up-to-date, this is your book; but don't expect an error-free and carefully edited or explained work.
I used this book as a practice guide for my interviews with Microsoft, Amazon, and Google. Got offered to two of the companies through practicing the questions in this book over and over again. I was only caught off guard by one or two questions during my interviews through at least 15 interview loops. Most of the interview questions at the above companies follow the same two dozen or so coding patterns and the questions in this book thoroughly covers them. Learn the coding patterns from this book and you won't be surprised or nervous during your loops. I tried not to act too surprised when 1/5 of the questions from my interviews were straight from the book.
good book, but so is the very similar book "Programming Interviews
Exposed: Secrets to Landing Your Next Job" (2nd edn), John Mongan,
Noah Suojanen and Eric Giguère (2nd edn, 2007) . Which should you
choose? Here are the main differences:
- "Exposed" is much more readable: it explains the solutions in
English before giving code, whereas "Cracking" often just presents
code with minimal explanation. Another nice thing is that "Exposed"
presents the solution in stages, so you can read the first part of the
solution to get a hint, and then try again. By contrast, "Cracking"
just gives the key idea right away, so even a "peek" at the solutions
means it's game over (modulo coding issues, which are usually easy).
- "Cracking" has more questions, and they generally seem to be a bit
harder. They are sorted in order of increasing difficulty, which is
- "Cracking" gives solutions in Java, although the code seems to have
some errors (see other reviews on amazon). "Exposed" gives solutions
in a mix of languages (C++, Java, C#), although they only use one
language per question.
- "Cracking" contains some grammatical errors (for example, Gayle
often mixes up "eg" and "ie"). In addition, many explanations would be much clearer with
- Both books are similar in length (about 300 pages), and their "non
technical" advice is very similar.
- Overall, "Exposed" is easier to read, but "Cracking" has more
content. Tough call.
There is also the good book "Algorithms For Interviews" by Adnan Aziz
and Amit Prakash (2010), which contains much harder questions,
focusing on clever algorithms and not on implementation details. Do
not attempt this book before mastering "Cracking" and/or "Exposed",
you will find it demoralizing! But it's probably worth trying some of
these harder problems, to see how "fancier" algorithms (like Dijkstra,
or max-flow min-cut, or dynamic programming) can be applied in
When I started my preparation, the entire process seemed really daunting. There is so much to study, and there is vast amount of study-material available out there. I was really confused on what/how to prepare. A friend of mine suggested me this book and so I read it.
To summarize, this book is an awesome compilation of problems, strategies and approaches you must know for doing well in a Tech interview.
It starts with chapters focusing on non-coding aspects (company-info, resume, behavioral etc.). I feel that, thoroughly covering just these first 30 pages is suffice for doing well in the 'HR' parts of tech-interviews.
After that, it contains 150 questions grouped by categories, covering all the relevant areas. And finally it has useful information, solutions and discussions for all the questions.
Qu. "If I memorize solutions for all these questions, Can I crack an Interview?" Ans. No Way!
Rather, if you slog through these questions, learning techniques; I am sure you will be able to solve questions on that day.
Solving problems through the book, I learnt different [ingenious] approaches. And with practice, I was be able to [/tried to] identify patterns in new questions that I faced.
I particularly love 3 chapters- "Recursion", "Moderate Interview Problems", "Hard Interview Problems". Because they contain some really neat algorithms :)
Hope this review helps.. And all the best for your interview :)
in page 47 Question: What is the running time of this code?
The two sample codes are exactly the same and the first one should be something not using StringBuffer().
And in page 258, in the middle paragraph
Time_Stamp(P2_1) - Time_Stamp(P2_N)
Time_Stamp(P2_1) - Time_Stamp(P1_N)
Hope this error can be identified by readers and they can still get the job.