New
Pages
708
Published
2015
Cracking the Coding Interview
189 Programming Questions and Solutions for Software Engineering Interviews
Walk into your next technical interview prepared to solve any coding problem on a whiteboard, under pressure, in front of a hiring panel.
Cracking the Coding Interview gives you the tools to decode exactly what interviewers at top tech companies are looking for and then deliver it. Gayle Laakmann McDowell draws on her experience as a software engineer at Google, Microsoft, and Apple — and as an interviewer — to walk you through 189 real interview questions, complete solutions, and the analytical frameworks you need to tackle problems you have never seen before.
About this book
Technical interviews at top software companies are not just tests of what you know. They are tests of how you think. Interviewers want to watch you break down ambiguous problems, recognize patterns, and reason aloud toward a working solution. Studying the wrong material in the wrong way leaves you stranded at the whiteboard even when you know the subject matter cold.
Cracking the Coding Interview gives you a precise map of that process. Gayle Laakmann McDowell spent years conducting and studying technical interviews at Google, Microsoft, and Apple. She identified the patterns that separate candidates who get offers from those who do not, and she built this book around closing that gap.
The core of the book is 189 coding problems drawn from real interviews, each paired with a detailed solution that shows not just the answer but the reasoning path from first principles to optimized code. Topics span arrays and strings, linked lists, stacks and queues, trees and graphs, sorting and searching, dynamic programming, system design, and behavioral questions — the full range of what a serious interview loop will cover.
Beyond the problems themselves, the book gives you concrete frameworks for:
- Estimating time and space complexity at a glance and communicating it clearly
- Handling questions you genuinely do not know — without freezing
- Walking through edge cases before an interviewer has to prompt you
- Structuring behavioral answers using the S.A.R. (Situation, Action, Result) format
- Evaluating offers, negotiating compensation, and choosing between competing roles
This sixth edition has been substantially revised and expanded from previous versions. Solutions are written in Java, but the analytical approaches apply regardless of which language you code in. Every chapter closes with hints so you can attempt problems without immediately reaching for the answer key.
Whether you are a new graduate targeting your first role or an experienced engineer aiming for a staff-level position, the preparation process is the same: deliberate practice on the right problems, reviewed against honest, detailed solutions. This book is that practice.
🎯 What you'll learn
- Recognize the underlying pattern in a new coding problem and choose an appropriate data structure or algorithm within minutes
- Analyze time and space complexity accurately and explain your reasoning out loud without hesitation
- Work through 189 real interview questions spanning arrays, trees, graphs, dynamic programming, sorting, and more
- Apply systematic debugging and edge-case analysis so you catch mistakes before the interviewer does
- Structure behavioral answers to make your experience and decision-making legible to any interviewer
- Approach system design questions with a repeatable framework that scales from small services to distributed systems
- Evaluate and negotiate job offers using criteria that go beyond base salary
👤 Who is this book for?
- New computer science graduates preparing for entry-level software engineering interviews at competitive tech companies
- Working engineers who have been out of the interview loop for years and need to rebuild their problem-solving fluency fast
- Self-taught developers who want an honest benchmark of what technical interviewers actually expect
- Engineers targeting senior or staff roles who need to sharpen system design and complexity analysis under time pressure
- Anyone who has failed a technical interview loop and wants a structured, evidence-based way to prepare differently
Table of contents
-
01
The Interview Process
Understand what interviewers are actually measuring and why the standard technical interview format exists. Learn how to shift your mindset from performing knowledge recall to demonstrating structured problem-solving.
-
02
Behind the Scenes
See how hiring pipelines work at companies like Google, Amazon, Microsoft, and startups, including who makes the decision and what a debrief looks like. Use this knowledge to tailor your preparation to the specific company you are targeting.
-
03
Special Situations
Prepare for interview formats that deviate from the standard loop: experienced-hire interviews, developer-tool roles, PM interviews, dev lead positions, and acquisitions. Each situation has distinct expectations that require a different approach.
-
04
Before the Interview
Build a preparation timeline, assemble your project list, and practice the written résumé content that determines whether you get the interview in the first place. Learn what a strong résumé for a technical role actually looks like.
-
05
Behavioral Questions
Construct a personal story matrix that lets you answer any behavioral question with a concrete, well-structured example. Practice the S.A.R. format and learn how to handle difficult scenarios like conflicts with managers.
-
06
Big O Notation
Develop a working, practical command of Big O time and space complexity so you can evaluate tradeoffs and answer complexity questions on the spot. Work through examples that cover the most common patterns you will encounter.
-
07
Technical Questions and Core Data Structures
Internalize the must-know data structures and algorithms — arrays, strings, linked lists, stacks, queues, trees, graphs, heaps, and hash tables — with explanations of when and why each applies. Use the provided problem-solving framework to approach any whiteboard question methodically.
-
08
189 Coding Problems and Solutions
Work through the full set of 189 interview problems organized by topic, each with multiple hints and a complete worked solution. Problems range from warm-up exercises to the level of difficulty found in onsite loops at top-tier companies.
-
09
System Design and Scalability
Apply a structured approach to open-ended system design questions, covering load balancing, caching, sharding, and service decomposition. Practice on realistic scenarios like designing a URL shortener or a social feed.
-
10
Sorting, Searching, and Advanced Topics
Master sorting algorithms, binary search variations, and advanced topics including bit manipulation, math and logic puzzles, and concurrency. Learn which problems are signals for which technique so you spend less time floundering during an interview.
Frequently asked questions
Do I need a computer science degree to use this book?
No. The book explains core data structures and algorithms from first principles. That said, you should already be comfortable writing code in at least one language before working through the problem sets.
What programming language are the solutions written in?
All solutions are written in Java. The problem-solving reasoning and complexity analysis apply to any language, and many readers work through the problems in Python, C++, or another language of their choice.
Is this book relevant for experienced engineers, or is it aimed at new graduates?
Both. The book covers the same problem categories that appear in senior and staff-level interview loops, including system design, and it includes guidance specifically for experienced-hire candidates.
How is the sixth edition different from older editions?
The sixth edition added roughly 70% new content compared to the fifth edition, including new problems, expanded solutions, an introduction to system design questions, and updated company-specific guidance.
How long does it realistically take to work through the book?
Most candidates spend four to twelve weeks depending on their starting point and how many hours per day they can dedicate. The book includes a suggested study plan to help you structure that time.
Does the book cover behavioral and soft-skills questions, or only coding?
It covers both. There are dedicated chapters on behavioral interviews, résumé preparation, offer evaluation, and how to communicate effectively at the whiteboard alongside all the coding content.
You might also like
New
New
Introduction to Algorithms, fourth edition
The definitive reference on algorithms and data structures for students and practicing engineers
by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
New
A Philosophy of Software Design
Timeless principles for managing complexity and writing software that lasts
New