Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
CRACKING THE
C O D I N G INTERVIEW
5th Edition
150 Programming Interview Questions and Solutions
GAYLE LAAKMANN MCDOWELL Founder and CEO, CareerCup.com
CareerCup, LLC Palo Alto, CA
Table of Contents
Foreword 1
Introduction 2
I. The Interview Process 5
Overview 6
How Questions are Selected 7
Timeline and Preparation Map 8
The Evaluation Process 10
Incorrect Answers 11
Dress Code 12
Top 10 Mistakes 13
Frequently Asked Questions 15
II. Behind the Scenes 17
The Microsoft Interview 19
The Amazon Interview 20
The Google Interview 21
The Apple Interview 22
The Facebook Interview 23
The Yahoo! Interview 24
III. Special Situations 25
Experienced Candidates 26
Testers and SDETs 27
Program and Product Managers 28
Dev Leads and Managers 30
Start-Ups 31
IV. Before the Interview 33
Getting the Right Experience 34
Building a Network 35
Writing a Great Resume 37
V. Behavioral Preparation 39
Behavioral Preparation 40
Handling Behavioral Questions 43
VI. Technical Questions 45
VI Cracking the Coding Interview
Table of Contents
Technical Preparation 46
Handling Technical Questions 49
Five Algorithm Approaches 52
What Good Coding Looks Like 56
VII. The Offer and Beyond 61
Handling Offers and Rejection 62
Evaluating the Offer 63
Negotiation 65
On the Job 66
VIM. Interview Questions 67
Data Structures 69
Chapter 1 | Arrays and Strings 71
Chapter 21 Linked Lists 75
Chapter 3 | Stacks and Queues 79
Chapter 41 Trees and Graphs 83
Concepts and Algorithms 87
Chapter 5 | Bit Manipulation 89
Chapter6 | Brain Teasers 93
Chapter 7 | Mathematics and Probability 97
Chapter 8 | Object-Oriented Design 103
Chapter 91 Recursion and Dynamic Programming 107
Chapter 101 Scalability and Memory Limits I l l
Chapter 11 | Sorting and Searching 117
Chapter 12 | Testing 123
Knowledge Based 131
Chapter 13 | С and C++ 133
Chapter 141 Java 141
Chapter 15 | Databases 147
Chapter 161 Threads and Locks 153
Additional Review Problems 161
Chapter 17 | Moderate 163
Chapter 18 | Hard 167
CrackingTheCodinglnterview.com VII
Table of Contents
IX. Solutions 169
Data Structures 171
Chapter 1 | Arrays and Strings 171
Chapter 2 | Linked Lists 183
Chapter 3 | Stacks and Queues 201
Chapter 4 | Trees and Graphs 219
Concepts and Algorithms 241
Chapter 5 | Bit Manipulation 241
Chapter 6 | Brain Teasers 257
Chapter 7 | Mathematics and Probability 263
Chapter 8 | Object-Oriented Design 279
Chapter 9 | Recursion and Dynamic Programming 315
Chapter 10 | Scalability and Memory Limits 341
Chapter 11 | Sorting and Searching 359
Chapter 12 | Testing 377
Knowledge Based 385
Chapter 13 | С and C++ 385
Chapter 14 | Java 399
Chapter 15 | Databases 407
Chapter 16 | Threads and Locks 415
Additional Review Problems 429
Chapter 17 | Moderate 429
Chapter 181 Hard 461
X. Acknowledgements 491
XI. Index 492
XII. About the Author 500
Join us at www.CrackingTheCodinglnterview.com to download full, compilable Java / Eclipse solutions, discuss problems from this book with other readers, report issues, view this book's errata, post your resume, and seek additional advice.
VIII Cracking the Coding Interview