Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Cracking the Coding Interview 
Gayle Laakmann McDowell 
Strategies to Prepare for and Crack the Programming Interview 
10/...
Hi! I’m Gayle LaakmannMcDowell 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
1 
(CS) (MBA) 
<dev> </dev>...
The Perfect Candidate 
2 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
The Perfect Candidate 
3 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
Does the “perfect” candidate really exist? 
… Yes. Many. Lots. 
BUT! Many successful candidates aren’t perfect!
TODAY’S AGENDA 
How to become a more perfect dev candidate
The Perfect Candidate 
6 
How to Become a More 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
7 
The Perfect Candidate 
How to Become a More 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
The Perfect Candidate 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
8 
How to Become a More 
•Coursera 
...
The Perfect Candidate 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
9 
How to Become a More 
• Hackathon...
The Perfect Candidate 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
10 
How to Become a More 
• Startups...
The Perfect Candidate 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
11 
How to Become a More 
• Length: ...
12 
The Perfect Candidate 
How to Become a More 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
13 
The Perfect Candidate 
How to Become a More 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
THE SOFT SQUISHY STUFF 
aka Behavioral Questions 
great bang for your buck
The Pitch / Resume Walk-Through 
15 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
Your Past Work/Projects 
• Prep 1 – 2 projects 
• Hard/Cool 
• You = Central 
• Technical Depth 
• All past work (esp. las...
Technical Questions 
Why why why why why why why why meeeee 
It happens for a reason.
What Really Happens 
18 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
What Really Happens 
• Knowledge Questions 
• Design/Scalability (+ coding) 
• Problem Solving (+ coding) 
• Coding 
gayle...
Knowledge Questions 
“What is a static class in Java?” 
Trivia, Details, etc.
Knowledge Questions 
• Know your stuff. 
• Be cautious about what you list. 
• If you don’t know, admit it. 
• Derive it i...
“Design Google Maps” 
System Design 
Complex Real-World Problems
Scalability/Design 
W 
W 
Y 
D 
A 
W 23 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
Scalability/Design 
What 
Would 
You 
Do 
At 
Work 24 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
Scalability/Design 
• Scope the problem 
• Ask questions 
• Figure out biggest components 
• Discuss tradeoffs 
• Think ab...
Problem Solving / Algorithm Questions 
Why why why why why why why why meeeee 
It happens for a reason.
Why? 
27 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
Why? 
• Strong foundation in CS 
• Analytic skills/intelligence. 
• Ability to make tradeoffs. 
• Discussion/teamwork abil...
How You Are Judged 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
29 
How did you do RELATIVE 
to other c...
Essential Knowledge 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
30 
Data Structures Algorithms Concept...
Preparation 
• Implement DS/Algorithms 
• MASTER Big O 
• Practice with interview questions 
• Code on paper/whiteboard 
•...
Solving a Problem Solving Question 
How to… attempt to nail a question in 7 easy[ish] steps 
There’s a method to the madne...
33 
CrackingTheCodingInterview.com 
“Resources” 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
0. TALK 
34 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
1. Listen 
35 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
2. Example 
BIG ENOUGH 
+ 
GENERAL PURPOSE 
36 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
Ex: Intersection of 2 Sorted Distinct Arrays 
[1, 12, 15, 19] 
[2, 12, 13, 20] 
gayle.com | twitter.com/gayle | facebook.c...
Ex: Intersection of 2 Sorted Distinct Arrays 
[1, 12, 15, 19, 20, 21] 
[2, 12, 13, 17, 18, 25] 
gayle.com | twitter.com/ga...
Ex: Intersection of 2 Sorted Distinct Arrays 
[1, 12, 15, 19, 20, 21] 
[2, 12, 13, 17, 18, 25, 27] 
gayle.com | twitter.co...
Ex: Intersection of 2 Sorted Distinct Arrays 
[1, 12, 15, 19, 20, 21] 
[2, 12, 13, 19, 18, 25, 27] 
gayle.com | twitter.co...
Ex: Intersection of 2 Sorted Distinct Arrays 
[1, 12, 15, 19, 20, 21] 
[2, 15, 17, 19, 21, 25, 27] 
gayle.com | twitter.co...
3. Brute Force 
42 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
4. Optimize 
43 
Walk 
through 
brute force 
Look for 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
opti...
4. Optimize… BUD? 
Bottlenecks 
Unnecessary work 
Duplicated work 
44 
gayle.com | twitter.com/gayle | facebook.com/gayle ...
Ex: Intersection of 2 Sorted Distinct Arrays 
[1, 12, 15, 19, 20, 21] 
[2, 15, 17, 19, 21, 25, 27] 
gayle.com | twitter.co...
Ex: a3 + b3 = c3 + d3 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
46 
Unnecessary work: 
looking for d
Ex: a3 + b3 = c3 + d3 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
47 
Unnecessary work: 
looking for d
Ex: a3 + b3 = c3 + d3 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
48 
Duplicated work: 
c, d pairs ove...
Ex: a3 + b3 = c3 + d3 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
49 
Duplicated work: 
c, d pairs ove...
Ex: a3 + b3 = c3 + d3 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
50 
Duplicated work: 
c, d pairs ove...
MORE! MORE! 
• BUD 
• Space/time tradeoff 
• Precompute / cache 
• Hash tables 
• Other DS: heaps, trees, stacks 
gayle.co...
5. Walk Through 
52 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
5. Walk Through 
53 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
Know the variables 
And when they chan...
6. Write BEAUTIFUL code 
54 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
6. Write BEAUTIFUL code 
•Well modularized 
• Error cases (at least with TODOs) 
• Clean and neat 
• Good variables 
gayle...
6. Modularized code 
56 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
7. Testing 
1. Conceptual - does it make sense? 
2. Weird stuff (x = len – 2) 
3. Hot spots (end of list) 
4. Small test c...
How You Are Judged 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
58 
How did you do RELATIVE 
to other c...
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
59 
So RELAX! 
Interviews are supposed to be hard! 
Everyon...
60 
Talk to your interviewer 
Be a great engineer. 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
More Resources 
gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 
61 
CareerCup.com 
• Interview Videos 
• Re...
Upcoming SlideShare
Loading in …5
×

Cracking the Coding Interview

9,101 views

Published on

CS interviews are a different breed from other interviews and, as such, require specialized skills and techniques. This talk will teach you how to prepare for coding interviews, what top companies like Google, Amazon, and Microsoft really look for, and how to tackle the toughest programming and algorithm problems. This is not a fluffy be-your-best talk; it is deeply technical and will discuss specific algorithm and data structure topics.

Published in: Technology
  • Be the first to comment

Cracking the Coding Interview

  1. 1. Cracking the Coding Interview Gayle Laakmann McDowell Strategies to Prepare for and Crack the Programming Interview 10/11/20 14
  2. 2. Hi! I’m Gayle LaakmannMcDowell gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 1 (CS) (MBA) <dev> </dev> Author Interview Coach Interview Consulting
  3. 3. The Perfect Candidate 2 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  4. 4. The Perfect Candidate 3 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  5. 5. Does the “perfect” candidate really exist? … Yes. Many. Lots. BUT! Many successful candidates aren’t perfect!
  6. 6. TODAY’S AGENDA How to become a more perfect dev candidate
  7. 7. The Perfect Candidate 6 How to Become a More gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  8. 8. 7 The Perfect Candidate How to Become a More gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  9. 9. The Perfect Candidate gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 8 How to Become a More •Coursera •Bootcamps •Read lots. •Write lots.
  10. 10. The Perfect Candidate gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 9 How to Become a More • Hackathons • Diversity languages. • Independent projects.
  11. 11. The Perfect Candidate gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 10 How to Become a More • Startups • Start your own
  12. 12. The Perfect Candidate gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 11 How to Become a More • Length: • 1 – 2 pages. • 1 – 2 lines per bullet. • 3 – 6 bullets per company. • Projects. • Clear accomplishments. • Technical… • But not overwhelming. CareerCup.com/Resume
  13. 13. 12 The Perfect Candidate How to Become a More gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  14. 14. 13 The Perfect Candidate How to Become a More gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  15. 15. THE SOFT SQUISHY STUFF aka Behavioral Questions great bang for your buck
  16. 16. The Pitch / Resume Walk-Through 15 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  17. 17. Your Past Work/Projects • Prep 1 – 2 projects • Hard/Cool • You = Central • Technical Depth • All past work (esp. last job) • Challenges, design/architecture, tradeoffs, gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 mistakes, successes, motivations • What did YOU do? 16
  18. 18. Technical Questions Why why why why why why why why meeeee It happens for a reason.
  19. 19. What Really Happens 18 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  20. 20. What Really Happens • Knowledge Questions • Design/Scalability (+ coding) • Problem Solving (+ coding) • Coding gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 19
  21. 21. Knowledge Questions “What is a static class in Java?” Trivia, Details, etc.
  22. 22. Knowledge Questions • Know your stuff. • Be cautious about what you list. • If you don’t know, admit it. • Derive it if possible. gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 21
  23. 23. “Design Google Maps” System Design Complex Real-World Problems
  24. 24. Scalability/Design W W Y D A W 23 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  25. 25. Scalability/Design What Would You Do At Work 24 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  26. 26. Scalability/Design • Scope the problem • Ask questions • Figure out biggest components • Discuss tradeoffs • Think about challenges/bottlenecks • TEAMWORK! gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 25
  27. 27. Problem Solving / Algorithm Questions Why why why why why why why why meeeee It happens for a reason.
  28. 28. Why? 27 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  29. 29. Why? • Strong foundation in CS • Analytic skills/intelligence. • Ability to make tradeoffs. • Discussion/teamwork ability. • How you think about a problem. gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 28
  30. 30. How You Are Judged gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 29 How did you do RELATIVE to other candidates on the SAME question?
  31. 31. Essential Knowledge gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 30 Data Structures Algorithms Concepts Arrays / ArrayLists Merge Sort Big O (Time & Space) Hash Tables Quick Sort Recursion Trees (+ Tries) Breadth-First Search Memoization / Dynamic Programming Graphs Depth-First Search Stacks / Queues Binary Search Heaps
  32. 32. Preparation • Implement DS/Algorithms • MASTER Big O • Practice with interview questions • Code on paper/whiteboard • Mock interviews gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 PUSH YOURSELF! 31
  33. 33. Solving a Problem Solving Question How to… attempt to nail a question in 7 easy[ish] steps There’s a method to the madness.
  34. 34. 33 CrackingTheCodingInterview.com “Resources” gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  35. 35. 0. TALK 34 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  36. 36. 1. Listen 35 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  37. 37. 2. Example BIG ENOUGH + GENERAL PURPOSE 36 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  38. 38. Ex: Intersection of 2 Sorted Distinct Arrays [1, 12, 15, 19] [2, 12, 13, 20] gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 37 Too small
  39. 39. Ex: Intersection of 2 Sorted Distinct Arrays [1, 12, 15, 19, 20, 21] [2, 12, 13, 17, 18, 25] gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 38 Special case |A| = |B|
  40. 40. Ex: Intersection of 2 Sorted Distinct Arrays [1, 12, 15, 19, 20, 21] [2, 12, 13, 17, 18, 25, 27] gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 39 Special case One element in common
  41. 41. Ex: Intersection of 2 Sorted Distinct Arrays [1, 12, 15, 19, 20, 21] [2, 12, 13, 19, 18, 25, 27] gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 40 Special case Common elements at same index
  42. 42. Ex: Intersection of 2 Sorted Distinct Arrays [1, 12, 15, 19, 20, 21] [2, 15, 17, 19, 21, 25, 27] gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 41 Good enough.
  43. 43. 3. Brute Force 42 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  44. 44. 4. Optimize 43 Walk through brute force Look for gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 optimizations (BUD!)
  45. 45. 4. Optimize… BUD? Bottlenecks Unnecessary work Duplicated work 44 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  46. 46. Ex: Intersection of 2 Sorted Distinct Arrays [1, 12, 15, 19, 20, 21] [2, 15, 17, 19, 21, 25, 27] gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 45 Bottleneck: searching
  47. 47. Ex: a3 + b3 = c3 + d3 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 46 Unnecessary work: looking for d
  48. 48. Ex: a3 + b3 = c3 + d3 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 47 Unnecessary work: looking for d
  49. 49. Ex: a3 + b3 = c3 + d3 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 48 Duplicated work: c, d pairs over and over
  50. 50. Ex: a3 + b3 = c3 + d3 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 49 Duplicated work: c, d pairs over and over
  51. 51. Ex: a3 + b3 = c3 + d3 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 50 Duplicated work: c, d pairs over and over
  52. 52. MORE! MORE! • BUD • Space/time tradeoff • Precompute / cache • Hash tables • Other DS: heaps, trees, stacks gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 PUSH YOURSELF! 51
  53. 53. 5. Walk Through 52 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  54. 54. 5. Walk Through 53 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 Know the variables And when they change
  55. 55. 6. Write BEAUTIFUL code 54 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  56. 56. 6. Write BEAUTIFUL code •Well modularized • Error cases (at least with TODOs) • Clean and neat • Good variables gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 55
  57. 57. 6. Modularized code 56 gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  58. 58. 7. Testing 1. Conceptual - does it make sense? 2. Weird stuff (x = len – 2) 3. Hot spots (end of list) 4. Small test cases 5. Special test cases gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 57
  59. 59. How You Are Judged gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 58 How did you do RELATIVE to other candidates on the SAME question?
  60. 60. gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 59 So RELAX! Interviews are supposed to be hard! Everyone makes mistakes. Everyone!
  61. 61. 60 Talk to your interviewer Be a great engineer. gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014
  62. 62. More Resources gayle.com | twitter.com/gayle | facebook.com/gayle 10/11/2014 61 CareerCup.com • Interview Videos • Resume Review • Mock Interviews • Consulting Or, follow me online at… • twitter.com/gayle • facebook.com/gayle • gayle.com • gayle@gayle.com • quora.com

×