Jump to ratings and reviews
Rate this book

Cracking the Coding Interview: 189 Programming Questions and Solutions

Rate this book
I am not a recruiter. I am a software engineer. And as such, I know what it's like to be asked to whip up brilliant algorithms on the spot and then write flawless code on a whiteboard. I've been through this as a candidate and as an interviewer.

Cracking the Coding Interview, 6th Edition is here to help you through this process, teaching you what you need to know and enabling you to perform at your very best. I've coached and interviewed hundreds of software engineers. The result is this book.

Learn how to uncover the hints and hidden details in a question, discover how to break down a problem into manageable chunks, develop techniques to unstick yourself when stuck, learn (or re-learn) core computer science concepts, and practice on 189 interview questions and solutions.

These interview questions are real; they are not pulled out of computer science textbooks. They reflect what's truly being asked at the top companies, so that you can be as prepared as possible. WHAT'S INSIDE?

189 programming interview questions, ranging from the basics to the trickiest algorithm problems.
A walk-through of how to derive each solution, so that you can learn how to get there yourself.
Hints on how to solve each of the 189 questions, just like what you would get in a real interview.
Five proven strategies to tackle algorithm questions, so that you can solve questions you haven't seen.
Extensive coverage of essential topics, such as big O time, data structures, and core algorithms.
A behind the scenes look at how top companies like Google and Facebook hire developers.
Techniques to prepare for and ace the soft side of the behavioral questions.
For interviewers and details on what makes a good interview question and hiring process.
Illustrations Illustrations, black and white

712 pages, Kindle Edition

Published August 17, 2020

432 people are currently reading
2034 people want to read

About the author

Gayle Laakmann McDowell

17 books307 followers
Gayle Laakmann McDowell is the founder / CEO of CareerCup, and the author of Cracking the PM Interview, Cracking the Coding Interview, and Cracking the Tech Career.

Gayle has worked for Microsoft, Apple and Google as a software engineer. She holds a bachelor's and master's degree from the University of Pennsylvania in Computer Science, and an MBA from the Wharton School. She currently resides in Palo Alto, CA.

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
220 (51%)
4 stars
145 (34%)
3 stars
49 (11%)
2 stars
8 (1%)
1 star
2 (<1%)
Displaying 1 - 30 of 34 reviews
Profile Image for Michael Burnam-Fink.
1,674 reviews290 followers
March 24, 2022
I'm mixed on this book. On the one hand, it helped me get an offer from a FAANG (study up on your binary trees, kids). On the other hand, it doesn't actually do a great job teaching the material, and the reference language is Java (ugh). This is a good refresher if it's been a while since CS101, but the best argument for this book is that it's dragged the world of tech interviews into it's gravitational field.
1 review2 followers
February 12, 2022
Life changing ROI. It’s a must read (and solve) for anyone serious in tech.

Please be warned that it takes a long time to work though the whole book.
Profile Image for Moritz.
46 reviews2 followers
July 5, 2022
It is a very good book for practicing algorithms, data structures and other interview topics. I can recommend it as a preparation for interviews, but also just to become a better software engineer. I came up with better and more efficient solutions to algorithmic problems at work after I read the book. While some topics might be only relevant for interviews, a lot of the content can be used practically at work.

Just to calm expectations a bit when starting to read this book: It took me about a year to finish the book, and for some problems I could not come up with a solution myself. The key is to not torture yourself, but to just read the solution when being stuck at a problem. That way it stays fun to read, and progress is possible.

I think a lot of people start reading the book with the expectation to solve all problems by themselves, no matter how long it takes. But this will destroy morale, and make you put the book away to never pick it up again. See it as an exercise. Try, try some more, if you still could not figure it out check the hints, if you still don't know how to solve it, check the solution. Understand the solution and implement it. This book tempts the reader to be very harsh on oneself. Don't fall for it, be kind to yourself, just like if you would teach someone else.
Profile Image for Felix Arribas Pardo.
11 reviews2 followers
October 13, 2023
Very good book to refresh what you learned in CS. It also provide good tips for the interviews.
However, there are a couple of thinks to bare in mind when reading this:
1. Not meant for Mobile Engineers: All the questions are related to data structures, algorithms and infrastructure useful for backend engineers. All system design questions are backend focused.
2. You better get a friend/colleague to mock interview you. Especially for System Design questions as they are quite open questions.
Profile Image for Pavle Pešić.
91 reviews2 followers
December 6, 2023
Top knjiga. Mislim da bi svaki programer trebalo da je pročita jednom u 2-3 godine.
Profile Image for Iain Davis.
14 reviews1 follower
March 15, 2025
TL;DR: I highly recommend, if you are a developer who still lakes paper books (or ebooks), this one ought to be on your shelf. Treat it like an ongoing fitness regimen, and use it to explore the differences between the languages you have in your toolbelt.

First, a disclaimer. I have not read this entire book. It was recommended to me as interview prep for a job I was recently pursuing, and I cherry picked the topics that seemed most valuable to me, and just tried to cover as much of that ground as I could in the time that was available. In fact, it quickly became clear that my ambitions for the provided exercises were not realistic, and I had to scale back to doing only the odd numbered exercises.

But let me review what I did do.

I read this book in it's latest (6th) edition. The sections I read were:
* The entirety of the first section covering basic concepts and general advice about the hiring process (Chapters I - VIII).
* Selected chapters from the second section, the interview questions
* Chapters 1 - 4
* Chapters 8 - 11
* For the chapters I read from the second section, I did as many of the odd-numbered exercises as felt appropriate to me, although in some cases, I moved on to the next section before completing all of them, making a cost-benefit analysis that it was more worthwhile to cover other ground.

This book is divided into several sections. The first is a quick review of generally useful interview advice. This ranges from an insider's perspective of the interview process at several major tech companies, to negotiation after an offer has been made, to advice on how to answer non-technical interview questions, to fundamental programming concepts like Big O notation. The second section is a collection of questions that are representative of the sort you may find in technical interviews, divided into chapters organized around some fundamental concept (arrays, recursion, sorting, etc.). After that are the detailed answers to those questions, then a section of hints that are organized in such a way that you cannot tell by looking at the hints directly which hint goes with which problem, but each exercises provides a set of identifiers for hints that are relative to itself. There are a few other sections, but these are the ones that will be relevant to my discussion.

I really value this book. I greatly appreciated the opportunity (for example) to revisit Big O notation. Big O is something that, since I left college, I mostly understand intuitively... that is, I understand that if I've got one loop inside another, I should probably eliminate that situation if I can, and binary search is going to be a whole lot faster than linear search. The book gave me the chance to reassure myself that I could discuss those concepts in more concrete terms and (mostly) get it right. To a near enough approximation, anyway... when you get down into determining the constant attached to an O(n log n) runtime, it's more math than I want to try to dig up from the depths of my memory. But I can arrive at O(n log n) correctly, and thanks to this book, I went into my interview knowing I could do that.

More generally, this book addresses what I find to be the most common shortcoming of tech books. If they give you exercises to work through on your own (rather than just code to read and copy) those examples tend to be very surface-y and happy-path oriented. They are enough to explain the concept in it's simplest, most un-complicated form, but not much more than that. What I miss from my college textbooks is a series of exercises, of increasing levels of complexity and engagement with edge-cases and nuance, that help you to have a concrete understanding of not just the concept at hand, but how it interacts with other concepts and real-world challenges. This book delivers that in spades. Some of these exercises are quite tough, if you're coming at them from seven years after your leaving academia. And I didn't even get to the last few chapters of the interview section where the tougher questions are gathered.

I felt challenged, and strengthened by the interview questions in this book (and sometimes frustrated, fatigued, and a bit over it). I intend to continue to use it in future as a resource to continue making me stronger as a developer, and also as a way to keep my skills up in multiple languages.

The exercises in this book are similar to code katas, but with at least one advantage (from my perspective). Code Kata sites tend to give you one challenge after another, and often, they're completely unrelated. With this book, you can choose to explore a particular concept in some depth with increasingly difficult exercises. Like kata, they are fundamentally a bit synthetic... you're going to encounter a lot of challenges that aren't the sort of thing you're likely to run into in the real world. But maybe that's in the nature of the thing.

I truly appreciate that the book doesn't give you an exercise, and assume you're going to be able to solve it, and then have a firm grasp of the concepts and move on. If you're not getting something right away, or you're close, but you can't quite get over some bump, this book wants you to get just as much help as you need, and leave you to handle as much as you can on your own. That's where the hints come in. Hints are not listed next to other hints for the same problem, so if you look up one, you don't accidentally get more help than you wanted. And if, even with all the hints, you're still stumped, the book will give you a full, detailed explanation. These are also valuable for validating your solution when you did come up with one.

I highly recommend Cracking the Coding Interview for developers who want to keep their fundamentals strong and are willing to commit some time to it once in a while. Completing this book is work. You will not race through it. But you will come out a better coder. It values not just learning, but training too. It meets you at whatever level you are at, and then tries to help you get up one more step at a time. I will be going back and working my way through the exercises, and I'll be using it to try to familiarize myself with languages I'm less proficient in (or only just learning) like Python and Go, and to keep up my skills in languages I used to use routinely but circumstance has sort of relegated to the past for me (like Java).
Profile Image for Hussein Lezzaik.
25 reviews
December 23, 2022
I read this book while I was an undergrad student preparing for coding interviews. It still remains in my opinion one of the bible books of coding interview preparation. You'll mostly benefit from the book if you're early in your career, not knowing how things work in the industry in order to get hired at big tech or even startups.

The book talks about how different companies conduct coding interviews, what they look for, and how to ace it as the title says. Most chapters of the book still remain valid to this day.

I wouldn't recommend anyone to learn data structures and algorithms from this book alone, as this book is more of a summary of the concepts asked during interviews, and a database of questions to practice.

I'd recommend people early in their careers to read this book and understand the system, because the game is the same from junior to staff positions.

However, if you actually want to practice my best advice is to actually practice pair programming with someone.
92 reviews1 follower
June 23, 2023
This book does exactly what it says it does. It goes over important concepts for getting through that difficult coding interview. Honestly, most places won't ask you the stuff in this book unless you're getting a job at Google or something.
Profile Image for Anton Antonov.
350 reviews48 followers
August 3, 2024
Along with "Programming Interviews Exposed," this is the other book I studied meticulously.

I've read it for the same reasons I wrote in https://www.goodreads.com/review/show....

I remember how much hassle it was to get to the book and how much it cost me at that time, with its cost, shipping, customs clearance, VAT, etc. It was an impactful amount on my salary, I'll tell you as much. 😅
But it's not sold in an electronic format, so you either commit to it or you're not truly serious about the topic. 😀

The book! "Cracking the Coding Interview" is a great book, genuinely great. It covers the whole FAANG interview process. It is meant to be a book to beat the FAANG system of technical interviews. Then there's the pragmatic format of common problem in the specific tech interview topic, such as "Bit manipulation". The specific chapter of the book covers the topic at hand, common problems, and specific questions. Hints, various logical paths to the questions are also explored. Early on, you learn that getting the "right answer" is not the most important thing during the interview. Rather, it's more important how you get to that, how you think inside the box a problem poses to you.

Nowadays, I still apply the technique of looking for B.U.D. (Unnecessary work, Bottlenecks, and Duplicate work) in my own work or while reviewing others'.

At this point, I say read the book by all means. It's valuable knowledge if you want to scratch the problem-solving itch in your mind.

However, it did not only do that to the industry. It had a major impact on the whole interview process by companies. While the book made many people into great problem solvers of a well-known problem, it also killed the creativity and personal approach in hiring. You are going to be a great problem solver for well-known problems, but it's uncertain whether that applies for new problems. Then the technical interview processes followed practice and also became soulless based on what I observed in the industry circa 2015-2016, to date.

I had different thoughts over the years about what a good technical interview must be and what questions we ask. While I do take a few notes from this specific book into practice, I have to admit that this book is not to be taken by tech interviewers as the go-to book for what problems to put in your tech interview. :))
1 review
December 10, 2024
Great read for anyone in their early career going through tech interviews for the first time, esp the early chapters taking you through the process of interview to offer / the game which is revenant always as an IC. Definitely already need a strong foundation of data structures & algorithms before getting into this, as this mostly is a refresher then dives into how to apply them to questions you’d see in an interview. It would be awesome to see solutions with different languages, specifically something dynamically typed as dynamically typed languages are even recommended in interviews meant to be completed quickly / correctly rather than time / space efficient. In today’s FAANG interviews, even more advanced dynamic programming and graph questions would be useful here. Probably would stick to getting leetcode premium / or a similar course instead of this going forward. But a great book for its time
Profile Image for Meshwil.
3 reviews
March 13, 2025
Honestly if you want to learn about Data Structures and Algorithms, you're better off learning about it practically. However, this book does a great job in showing you what different data structures exist. I like the notion of having questions from the book, although, it's better if you use updated resources like roadmap.sh, neetcode.io (neetcode 150 roadmap) or some course in Udemy as it's more practical. Just reading doesn't do it justice as there needs to be a practical element.
I have a hard copy but I never used it as I used the resources mentioned above. All in all, if you're a complete beginner, get this book. However, if you want to learn optimally, I suggest that you just use the resources I mentioned above and save yourself the hassle of spending your precious time and money than reading this behemoth of a book.
Profile Image for Mark Lacanilao.
14 reviews
July 29, 2025
Good read. Easy to digest for anyone who needs a Data Structures & Algorithms refresher but it's a little outdated. It's missing a few topics like backtracking and greedy algorithms, which you'll see on LeetCode.

You're better off grinding NeetCode but it makes for a nice companion book if you need a quick explanation on Big-O Notation as you're solving problems. CTCI isn't quite in-depth enough to be a good intro to DS&A nor is it beefy enough serve as a sole resource for FAANG interviews. I recommend reviewing Parts VI and VII of this book then immediately tackling LeetCode questions.

If you need more in-depth theory, I'd actually recommend the Algorithm Design Manual by Skiena instead!

Side note: Python and C++ editions would be nice for the Java averse.
Profile Image for Hafi Ansari.
23 reviews1 follower
June 12, 2022
Been using this for the last year and I wish I’d used it earlier (would’ve made getting my first internship so much easier). It’s pretty much the gold standard for technical interviews. You should go in having a solid grasp of the fundamentals of Data Structures & Algorithms because the most you’ll get is a page or so describing the heuristics and theory/application before it goes into practice problems. The book isn’t a substitute for LeetCode (nothing can substitute the actual grind) but is comprehensive in strategies you can and should employ as well as how you should approach whiteboarding, behavioral interviews, and overall how to improve holistically in the interview process.
5 reviews
August 16, 2023
I used the book to help me on my journey of preparing for technical interviews, but it ended up being helpful for more than just the technical parts.

I really liked how the book broke down the interviews to cover both the behavioral and technical aspects. It gave me a clear understanding of what interviews are all about.

Even though the book was a great guide, I have to admit that the programming questions and solutions were quite advanced. I found it helpful to use other resources alongside the book because I sometimes struggled to grasp everything on my own. So, my suggestion is to use the book as a resource to help you get an overall idea, rather than relying solely on it for learning.
Profile Image for DW.
538 reviews7 followers
February 15, 2025
Anxiety-inducing.

Got the paperback from the library. People online say that this book is outdated - it could definitely use a new edition that doesn't talk as much about whiteboard coding. And I hope the silly estimation questions have fallen out of style. But this book has good tips on how to think about approaching problems that you won't find on leetcode - for instance "try listing all the data structures you know and see if one helps solve the problem." Inelegant but practical.

Their timeline for preparing for an interview starts 12 months before ... um, some of us don't have that much time.
11 reviews
March 20, 2024
Some will tell you the meaning of life is found in the lives we love and the adventures we build. For everyone else, we measure our b*ssy in bands. I doubt a single other book is as directly beneficial to my financial wellbeing. I'm only giving it 4 stars because I found out about Neetcode and never need to see the soulless, black wells that Gayle McDowell calls 'eyes' every again.
Profile Image for Oskar Bringle.
7 reviews1 follower
January 21, 2025
Read about 100 pages. I think it's a good book for coding interviews, however, there's so much valuable information online that trumps this. Leetcode + youtube + chatGPT combination is ultimately better for both time and money purposes. I think reading the behavioral section, as well as getting a ltitle into the technical section is good for anyone trying to break into the field tho.
Profile Image for Charlie.
3 reviews
February 4, 2025
This book is a staple for learning DSA for a reason. The fundamental patterns and strategies for solving complex problems that this book presents are timeless. However, I do think the strategies for "cracking" interviews for specific companies are a bit dated (obviously--given the book was published in 2008).
7 reviews
June 5, 2025
A good book. I should read it again, probably, it's a big book, so I would read it in chunks. Ideally, I would go about it to focus learning on a specific section and kinda hop around in the book for what I need at the time rather than front to back, as it isn't that type of book. At the end of the day it's a very educational book, and I found great value from specific areas
Profile Image for Enis Yılmaz.
17 reviews
December 12, 2021
Bir yazılım geliştirici iseniz referans kitabınız olmalıdır.
If you have software developer, you should take the book as reference for you.
Profile Image for Mind.
117 reviews17 followers
August 12, 2022
کتاب در راستای آمادگی برای مصاحبه های کدینگ
5 reviews4 followers
March 11, 2024
Invaluable for acing leetcode type interviews
54 reviews3 followers
April 29, 2024
I am so grateful for this book!
Profile Image for Stan Ford.
103 reviews3 followers
August 9, 2024
A good overview of common paradigms. A bit basic though. I'd recommend reading this book to check which topics you need to understand better, then delving deep through other sources.
16 reviews
June 21, 2025
Great advice in general, a little outdated :/ Use it for behavioural questions and general timeline advice but I would recommend doing questions online using leetcode/neetcode/hackerrank.
94 reviews1 follower
July 20, 2025
read the whole thing but did not do the questions, which are lowkey more important

truly a skill issue
Displaying 1 - 30 of 34 reviews

Can't find what you're looking for?

Get help and learn more about the design.