Cracking the Coding Interview, 6th Edition: 189 Programming Questions and Solutions
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 interview: behavioral questions.
- For interviewers and companies: details on what makes a good interview question and hiring process.
About the author Gayle Laakmann McDowell:
Gayle Laakmann McDowell is an author, consultant, and founder focusing on improving tech hiring for both the interviewer and the candidate.
Gayle has worked as an engineer for Google, Microsoft, and Apple. Most recently, at Google, she served on the hiring committee where she interviewed hundreds of candidates and evaluated thousands more. It was here that she discovered the disconnect between candidates, their skill set, and their interview performance.
Through her company, CareerCup, Gayle has worked with many of the top tech companies to reform their hiring practices and implement interviewer training programs.
She is the author and creator of the best-selling Cracking the Interview & Career series: Cracking the Coding Interview, Cracking the PM Interview (co-authored with Jackie Bavaro), Cracking the PM Career (co-authored with Jackie Bavaro), and Cracking the Tech Career
Gayle holds a bachelor’s and master’s in Computer Science from the University of Pennsylvania and an MBA from the Wharton School of Business.
Reviews about the ebook Case Interview Secrets:
- Vaibhav Singh:
Cracking the Coding Interview The best book for coding interviews, period. Gayle Laakmann McDowell cuts through the crap and clearly establishes what is important and what is not. Also, this book serves as a guide for a lot of recruiters out there.
I’m sure this is a good book Cracking the Coding Interview. However, you would think a book on software would have what language it is focused on readily available. It does not. I had to do research to figure it out… after purchasing it. Very annoying. For your info, it’s in java. If you’re not a java developer it’s useless until you decide you want to learn java. And by that time you’re probably working and don’t need an interview prep book. PUT THE LANGUAGE ON THE FRONT PAGE.
- Yura Gavrilovich:
Great ebook for preparing for the coding interview. Explains how a typical interview goes in big corporations like Google, Amazon, etc. Gives you concrete steps to prepare yourself for all interview stages. And the most important part, which takes ~70% of the book, problems with detailed solutions. Prepare to spend most of your time not reading the book Cracking the Coding Interview, but solving problems.
Here, in Silicon Valley, it seems like EVERYONE knows this book Cracking the Coding Interview. It seems like everyone who comes here from India and China knows it as well. I’m from Europe, and I had never heard of it. So I bought it. I read it. And I did some of the many exercises. Did I learn anything? Not really. Is it good for interview training? Absolutely, yes.PROs:
+ The first few chapters are short recaps of what you should already know.
+ There are hundreds of interview-like questions. Very algorithm-oriented. Which is indeed what tech companies ask.
+ This book might indeed improve your chances at Apple, Google, Facebook, etc…CONs:
– Cracking the Coding Interview book will NOT make you a better software engineer. It only helps you at the interview-part.
Proven – no one cares how good you are when interviewing with Major Tech Companies. Your real skills for future work and interview process have close to nothing in common. Everyone in Main Tech looks at how well have you studied this book. I find it awful, but if you want to land such a job – this book is a must. Book itself is good though if you just want to cover/refresh a list of IT topics.
- Mayank Pratap:
This book is a must-read for coding interview preparation. Not only the questions are great but Gayle explains the approach to breakdown different problems into steps so that you can easily tackle problems you have never solved before. Cracking the Coding Interview book helped me in my placement interviews and I was able to crack interviews of companies like Oracle, Amazon easily.
- Sean Callanan:
This got me through four interviews, and I got an offer from each one. I would recommend this to anyone, with two big provisos:
(1) if you’re going for a domain-specific position like compilers, make sure to read up on those separately
(2) focus on the Moderate problems. The Hard problems frankly weren’t asked and it was much more important to have the whiteboard coding method down.
- Tim O’Hearn:
I’ve been through this book Cracking the Coding Interview, front to back, many times, and, this time, I’ve shelved it with great optimism. So here’s to you, Gayle. You’ve helped mediocre students like me to chase their wildest dreams without concession. Reviewing CtCI has traditionally been considered the best way to test Software Engineering fundamentals among those entering the industry. With the popularization of interactive platforms like HackerRank and Leetcode, it has become a rite of passage among undergraduates to grind practice problems for hundreds of hours. The result of this leading to highly-desirable career outcomes is that
1. You have a lot of people studying Computer Science for the wrong reason (E.G. CS is the new pre-med)
2. Most other skills that are important for those working in the industry are deemphasized.
3. There is increased homogeneity in an almost exclusively negative sense.I don’t place the blame on Gayle for what has happened nor do I blame companies that use permutations of these classic problems to screen tens of thousands of candidates. Many people who studied Computer Science did so because they saw it as the best way to satisfy their desire to solve interesting problems and hate it if you must, but this is just a book filled with fun little problems to solve. You signed up for it! Getting toasted in a Facebook interview doesn’t mean that the candidate evaluation process is broken!
Anyway, it’s a classic book Cracking the Coding Interview. People probably recommend “better” things now but, as you can probably imagine, most of the problems you’ll find elsewhere will be similar if not identical. I’m getting a bit old for this now, though, and I’m hoping I never have to open the book again.
- Paul Ewing:
I graduated with a CS degree in 2014 and recently decided to find a new job. The first 200 or so pages are a great review for someone who wants to brush up on all of the “must-know” topics such as data structures, search algorithms, algorithmic complexity, sorting, etc. There are a handful of questions specific to each of these chapters.After the chapters come to a slough of example interview questions rated as easy/medium/hard, each with hints that interviewers might provide if you were to get stuck as well as a solution.Interviewing with companies can be a pretty grueling process so if you want a much better chance of landing the job the first time, I would highly recommend this ebook Cracking the Coding Interview.
- Khoi Nguyen:
It is so great to have detailed advice about everything of a coding interview. Clear writing, straight-forward discussion about salary-dealing or why algorithmic interviews are still dominant.
This is obviously the must-have book Cracking the Coding Interview to prepare for your SWE/SDE interview. I have some small quibbles with how some of the problems were worded, but the level of difficulty is very representative of what the big tech companies are using. You might even run into these questions in your own interviews since Gayle is choosing questions that are popular among interviewers today. If you have time, you should of course pick up an algorithms textbook also. I recommend Skiena’s The Algorithm Design Manual and Sedgewick’s Algorithms (4th Edition) textbooks. The classic Cormen is too verbose and proof-heavy for the purposes of preparing for an interview.
- Vitaliy Zasadnyy:
Cracking the Coding Interview One of the best books to prepare for the technical interview. It covers everything starting from questions on your previous experience and finishing hardcore algorithms. If you have 3+ months before your first tech interview – this book is probably your best bet.And it works, thanks to it (and a bunch of others) I managed to get offers from Facebook and Google.
- Akash Raj Singh:
Looking for a change in Job?
Want to crack all the codes thrown towards you?
Not good at the advanced techniques of coding?
Then, Cracking the Coding Interview book is for you. P.S.: This is not for Beginners. You should be familiar with the basics first
I was searching for software engineering internships for this summer. Before reading this book, I failed all four tech interviews with various companies, 2 bigger companies, and 2 startups. And then I got more interviews, and I decided to spend a weekend reading this book. I passed the subsequent interviews with three companies, including Google and a hot SF startup. I learned some key crucial techniques from this book which I applied to my latter interviews, they are:1. Talk out loud so that your interviewer can be on the same page of where you are in your thinking process and can correct you if you go awry.
2. Use simple examples to help thinking. It’s a lot easier to think about a concrete example than an abstract problem.
3. Various techniques to decrease the time and space complexity of your algorithm.
4. A different way to look at technical interviews: it’s not about solving the problem, it’s about showing your thinking process and logical reasoning capabilities.Really recommend it to anyone prepping for coding interviews.
- Zeyuan Hu:
It includes all that a programmer needs to develop at the time of entering google or any other high-class company. It prepares up to the most reachest level. It includes all the plans to crack interviews of coding.
- Daniel Nachev:
This book is a must-have for any software engineer. It doesn’t matter whether you already have the perfect job or you are a college graduate, who needs to find your first job – it provides a good base for how programming interviews are done in the majority of software companies. The book is structured in two parts: an overview of how interviews for software engineers proceed and actual coding exercises with hints and complete answers.The overview of the interview process focuses on how most of the interviews in the software companies are done and confirming the fact that the majority of the time in these interviews is spent actually coding on the whiteboard, which for bad or good is quite different than coding on a computer. Probably the main takeaways are:
The goal of the coding in the interview process is not to find out what you know, but how you approach and think through a problem, which you’ve never encountered before. Observing what you know is a side-effect of facing an unfamiliar problem, which often requires the application of the knowledge you already know.
No one expects you to solve a problem immediately or in one try. The goal is to see how you react to the unfamiliar situation – the ability to find information, analyze the problem looking for a starting point, etc.
On a similar note, no one expects to be able to answer all the questions. You are graded not based on whether you answered all questions or not, but on how well you perform against other interview candidates.
I’ve rated this as a four-star as the book Cracking the Coding Interview seems to be well written. I only got so far before I gave up.
The reason for this is: I graduated and was looking for developer jobs and thought this book would be great!
Perhaps it is great for someone with a few years of experience that’s looking for a senior developer role.
As a junior, this was out with my skill set or knowledge l.
The book is well written don’t get me wrong and you will learn a lot from it but I think it would require sitting down and making this a study book.
No doubt I will go back to this in a few years when I have a far greater knowledge and can understand this.
This is a great interview prep book Cracking the Coding Interview, and I would recommend catering your focus to the types of companies you’re interviewing with.In general, most companies probably aren’t going to give you questions from math/probability and brain teasers (the exception is the big-name companies the author mentions, Microsoft, Google, Amazon, etc.).I actually brushed up on the java section last night before an interview today, and believe it or not, I was asked about a topic from the java overview
This book is great for computer science students or for anyone in a similar situation looking for a graduate job.
I’ve used it to help me in securing jobs for my placement module as part of my degree (penultimate year).
It covers everything you would need to learn to prepare you for a serious interview with a large organization such as Google, Microsoft, IBM, and Oracle, etc.
I’ve read it all and seen most of the examples come up in real interviews. It’s very useful, I recommend reading it if you are serious about securing a role within a large software-based organization.
Not only does it help with interviews but it will help you within the university itself, considering you are a student. It covers various algorithms that most students will cover within the university.
- Mohamed Elsherif:
For better or for worse, this book is a must-read for any developer, at least from a pragmatic point of view, I personally don’t see the current interview practices as any good, but the reality is reality.
I used this book to help return to a senior Dev role after a few years working as a management consultant. Great explanation of concepts covering the main types of collections, data types, and sorting algorithms. Each problem has a detailed answer provided in java with commentary explaining a good solution through to the most optimal (and explaining the trade-offs to consider when evaluating different solutions). It separates the questions and answers and encourages you to attempt the problems without cheating, even including hints to help one work through the problem before checking the answer.
- Rod Hilton:
I absolutely hate the way technical interviews are done for programmers. Can you imagine if a heart surgeon went to interview at a hospital, and they handed him a game of “Operation” to play? That’s how we interview programmers. It’s so stupid, I could go on and on about it for paragraphs.But, if you want to work at the top tech companies in the world, you have to play the game, incredibly stupid and poorly aligned it is to the task at hand. And if you’re about to head out on some coding interviews, reading Cracking the Coding Interview is the single most important thing you can do for yourself. It’s simply phenomenal.There are definitely some sections that Gayle doesn’t seem particularly interested in. For example, the coverage of Bit Manipulation seemed a bit cursory, like it’s an area that she’s not super familiar with or comfortable with herself. But for the most part, all of the major stuff is covered, in the right level of detail. It’s good to review but if you weren’t already somewhat familiar with a lot of these data structures and concepts, I’m not sure that the book works as an introduction.
One major omission is the coverage of Tries. They get a shout-out as a data structure that basically doesn’t show up in interviews, but I interviewed at 5 major tech companies after reading this book and Tries were the right solution in three of them.
Overall though, the reason to get this book is for the set of questions. Questions that are exactly the kind of things you get asked in coding interviews. Each question has some hints, as well as the answers in the back. Take the book, and practice solving the problems on an actual whiteboard. Don’t skip to the answers, but feel free to read the hints (most interviewers will provide similar hints).
There’s simply nothing else you can do that better emulates the coding interview than practicing the problems in this book. It’s a must-have.