Cracking The Coding Interview
Cracking The Coding Interview
the
CODING INTERVIEW
189 PROGRAMMING QUESTIONS & SOLUTIONS
CODING INTERVIEW
G T H EDITION
A L S O BY GAYLE L A A K M A N N M C D O W E L L
INSIDER ADVICE ON LANDING A JOB AT GOOGLE, MICROSOFT, APPLE, OR A N Y TOP TECH COMPANY
CRACKING
CODING INTERVIEW
6th Edition
189 Programming Questions and Solutions
CareerCup, LLC
Palo Alto, CA
C R A C K I N G T H E C O D I N G INTERVIEW, SIXTH E D I T I O N
All rights reserved. No part of this book may be reproduced in any form by any electronic or me-
chanical means, including information storage and retrieval systems, without permission in writing
from the author or publisher, except by a reviewer who may quote brief passages in a review.
Introduction 2
Why? 4
Experienced Candidates 15
Startups 18
For Interviewers 21
Preparation Map 30
V. Behavioral Questions 32
VI. BigO 38
An Analogy 38
Time Complexity 38
Space Complexity 40
Amortized Time 43
Log N Runtimes 44
Recursive Runtimes 44
How to Prepare 60
Negotiation 84
On the Job 85
Data Structures 88
Hash Tables 88
StringBuilder 89
Recursive Problems 93
Implementing a Stack 96
Implementing a Queue 97
Chapter 4 | Trees and Graphs 100
Graphs 105
Probability 119
KeyConcepts 140