1. Cracking the Coding Interview
Advice and Strategies for Software
Engineering and PM Interviews
Gayle Laakmann McDowell
Founder / CEO, CareerCup.com
Author of The Google Resume and Cracking the Coding Interview
McDowell | CareerCup.com | Women Who Code
Aug 2012
2. Technical Skills
My Background
• Software Engineer @ GOOG, MS & Apple
– 3 Years on Google Hiring Committee
Behavioral
– Interviewed 150+ candidates
• Founder of CareerCup.com
– 8000+ tech interview questions
Applying
• Author
– Cracking the Coding Interview
– The Google Resume
Process
McDowell | CareerCup.com
7. Technical Skills
Start-Ups
• Coding + Intelligence
• “Hit the ground running”
Behavioral
– Do you know “their” technologies?
• Entrepreneurial
– Have you started things?
Applying
– How much direction do you need?
but…
• Personality it varies!
– Will you fit with the team?
Process
McDowell | CareerCup.com
8. Technical Skills
PM Roles
• Communication Skills
• User-Focused Thinking
Behavioral
• Passion for Technology
• Analytical Skills
• Technical Skills (position dependent)
Applying
Process
McDowell | CareerCup.com
9. Technical Skills
How You Are Judged
How did you do RELATIVE
to other candidates on
the SAME question?
Behavioral
It’s not about how
quickly you solved
Applying
the problem…
… it’s about how quickly
you solved it relative to
Process
other candidates.
McDowell | CareerCup.com
11. Technical Skills
How to Get an Interview
• Your “Pedigree”
– Education
Behavioral
– Work Experience
– Projects
– Github / Online Profile
• Make an awesome resume
Applying
Process
McDowell | CareerCup.com
12. Technical Skills
How We Review Resumes
1. Pull resume out of giant stack
2. Spot-check: company names, “Glanced
at,” not read.
positions, projects, schools.
Behavioral
15 – 30
3. Skim bullets to see if you’ve seconds
written real code.
Applying
Reject Interview
4. Go to next resume & whine about
how many more you have left.
Process
McDowell | CareerCup.com
13. How CS Resume
Should Look Observe: No Objective!
Objectives / summaries
One Page Only! are almost always useless.
Unless > 10 years exp.
A Real Resume Format
with organized columns
Short (1 – 2 line bullets)
Focus on Accomplishments
not responsibilities
GPA if at least 3.0
max (in-major, overall)
3 – 4 Projects
Courses & independent
Finished or unfinished
List of Technical Skills
Short! Cut the “fluff.”
14. Technical Skills
Talking to Recruiters
• Show:
– What you’ve done (mobile app? Show it!)
Behavioral
– What you’re excited about
• Have a “pitch” ready
• Weird is okay
Applying
– (arrogant is not)
Process
McDowell | CareerCup.com
16. Technical Skills
Communication Goals
• Answer the question.
• Deliver a *good* answer.
Behavioral
• Communicate well.
Applying
Process
McDowell | CareerCup.com
17. Technical Skills
Preparing for Behavioral Qs
• Create Preparation Grid for Projects
OS Project Amazon Intern.
Behavioral
Enjoyed
Hated
Most Challenging
Applying
Hardest Bug
+ Behavioral Grid [for PM & less tech. roles]
Process
McDowell | CareerCup.com
18. Technical Skills
Structure 1: Nugget First
• Lead with your “thesis” / nugget
– Grabs the listener’s attention
Behavioral
– Gives them context for where you’re going.
Q: What accomplishment are you
most proud of?
Applying
A: I’m most proud of the way I
re-architected the …
Process
McDowell | CareerCup.com
19. Technical Skills
Structure 2: S.A.R.
S ituation What was the issue?
Behavioral
A ction What did you do about it?
R esult What was the impact?
Applying
Process
McDowell | CareerCup.com
21. Technical Skills
How to study
• Study the basics
– Complex algorithms generally unnecessary.
Behavioral
• Practice solving questions
– Don’t memorize!
– See: CtCI & CareerCup.com
Applying
• Push yourself!
• Write code on paper
Process
McDowell | CareerCup.com
22. Technical Skills
Data Structures
• How to implement
• When to use (pros / cons)
Behavioral
Linked Lists Stacks Queues
Trees Tries Graphs
Applying
Vectors Heaps Hashtables
Process
McDowell | CareerCup.com
23. Technical Skills
Algorithms
• Implementation
• Space vs. Time Quick Sort Merge Sort
Complexity
Behavioral
Tree Insert / Find Binary Search
Applying
Breadth-First Depth-First
Search Search
Process
McDowell | CareerCup.com
24. Technical Skills
Concepts
• Not just a concept – know how to code!
Behavioral
System Design & Memory
Threading
Scalability Management
Applying
Probability +
Recursion Bit Manipulation
Combinatorics
Process
McDowell | CareerCup.com
25. Technical Skills How to Learn CS Fundamentals?
• Necessary for “elite” tech companies
– Not necessarily otherwise (check interview
questions)
Behavioral
• MIT Open Courseware
– Freshman / sophomore level DS & Algo
courses
• Books
Applying
– CLRS (Algorithms)
• Online tutorials
• Practice implementing and using
Process
McDowell | CareerCup.com
28. Technical
Product Design Questions
How would you design an
calculator for the blind?
Estimation
Design an elevator for a building.
Pick a Google product.
Product Design
How would you improve it?
29. Technical Product Design Questions: Why?
• Communication & Structured Thinking
• Ability to understand the user
• Creativity
Estimation
• Business instincts / skills
Product Design
30. Technical
Product Design Qs: Approach
1. Ask questions to resolve ambiguity
2. Understand the user
3. Structure the problem
Estimation
4. Solve piece by piece
Product Design
31. Technical
Product Design Qs: Example
How would you design a calculator for the blind?
Step 1: Ask Questions
• Adults? Children? Professionals?
Estimation
• Where are they using it?
– School, work, etc.
Product Design
32. Technical
Product Design Qs: Example
How would you design a calculator for the blind?
Step 2: Understand the User
• What’s important to a blind child?
Estimation
– Keeping up with the rest of the class
– Not feeling “different”
– Efficient input / output
• What about teachers, parents,
Product Design
classmates, etc.?
33. Technical
Product Design Qs: Example
How would you design a calculator for the blind?
Step 3: Structure
• Find a structure
Estimation
– Otherwise, you’re just blabbering
• One approach:
1. Make list of functions necessary
2. Discuss how to do input / output
Product Design
3. Usability for non-blind
4. Summary
34. Technical
Product Design Qs: Example
How would you design a calculator for the blind?
Step 4: Solve!
Estimation
Product Design
35. Technical
Estimation Questions
How many tennis balls
can fit in an SUV?
Estimation
How much money does Gmail make
from ads every year?
How much do New Yorkers
Product Design
spend on electricity each year?
37. Technical Estimation Qs: How to Approach
1. Ask questions to resolve ambiguity
– Don’t make assumptions (yet)
2. Outline / Structure Your Approach
3. Break down the components
Estimation
– Assume numbers when necessary
– State assumptions explicitly
– Round numbers to make your math easier
4. Sanity Check
Product Design
– Do your numbers make sense?
38. Technical
Estimation Qs: Example
How much money does Gmail make from ads every year?
Step 1: Ambiguous Information
• Profit or revenue?
Estimation
• Past year? Or average over history?
• Gmail only? Or include Google Apps?
Product Design
39. Technical
Estimation Qs: Example
How much money does Gmail make from ads every year?
Step 2: Outline Your Approach
(# of users)
Estimation
x
(# clicks / year)
x
( $ / click )
Product Design
40. Technical
Estimation Qs: Example
How much money does Gmail make from ads every year?
Step 3: Break down components
Estimate # of Gmail users in the US
Estimation
1. Assume 300 million people in the US.
– Exclude 0 - 12 years old and 65 - 75 years old
– ~ 200 million
2. Assume 80% of people use email
3. 80% of those have non-work account
Product Design
… and so on …
41. Technical
Estimation Qs: Example
How much money does Gmail make from ads every year?
Step 4: Validate Numbers
• Could revenue be $5 billion?
Estimation
• No, because…
– Google’s annual revenue is ~$40 billion
– $16 / US citizen (not just Gmail users)
Product Design
42. Technical
How to Solve Tough Problems
1. Ask Questions!
– Questions are more ambiguous than they appear
2. Talk out loud
– Show us how you think
Estimation
3. Think critically
– Does your algorithm really work? What’s the
space and time complexity?
4. Code slowly and methodically
– It’s not a race
5. Test your code
Product Design
– And make CAREFUL fixes.
McDowell | CareerCup.com
43. Technical
What does a “good coder” do?
• Code in top-left of whiteboard
• Pseudocode first (if necessary)
• Be methodical. Don’t try to rush.
Estimation
• Reasonably Bug Free
– Thorough testing (and careful fixing)
– Check for error conditions
• Clean coding
– Use other functions
Product Design
– Good use of data structures (define own if useful)
– Concise and readable
McDowell | CareerCup.com
44. Technical Types of Interview Questions
Coding & Algorithms Object Oriented Design System Design
Pattern Matching
Estimation
Simplify & Generalize
Base Case & Build
Data Structure
Brainstorm
Product Design
McDowell | CareerCup.com
45. Technical Algorithm Qs: Pattern Matching
Coding & Algorithms Object Oriented Design System Design
Pattern Matching
Q: Write code to reverse the order of words
in a sentence.
Estimation
Simplify & Generalize “dogs are cute”
“cute are dogs”
Base Case & Build Similar to: reverse characters in a string.
“dogs are cute”
Data Structure “etuc era sgod”
Brainstorm
Product Design
A: Reverse full string, then reverse each
word.
McDowell | CareerCup.com
46. Technical Algorithm Qs: Simplify & Generalize
Coding & Algorithms Object Oriented Design System Design
Pattern Matching
Q: Design algorithm to figure out if you can
build a ransom note (array of strings) from a
Estimation
Simplify & Generalize magazine (array of strings).
Simplify: what if we used characters instead
Base Case & Build of strings?
Build array of character frequencies.
Data Structure
Brainstorm
Product Design
Generalize: how we can extend answer to
words?
A: Build hashtable from word to frequency.
McDowell | CareerCup.com
47. Technical Algorithm Qs: Base Case & Build
Coding & Algorithms Object Oriented Design System Design
Pattern Matching Q: Design algorithm to print subsets of set.
{a, b, c} {}, {a}, {b}, {c}, {a, b},
Estimation
Simplify & Generalize {a, c}, {b, c}, {a, b, c}
S({}) {}
Base Case & Build S({a}) {}, {a}
S({a, b}) {}, {a}, {b}, {a, b}
Data Structure S({a, b, c}) ?
Brainstorm
Product Design
A: Build S(n) by cloning S(n-1) and adding n
to the cloned sets.
McDowell | CareerCup.com
48. Technical Algorithm Qs: Data Structure Brainstorm
Coding & Algorithms Object Oriented Design System Design
Pattern Matching Q: There are 10^10 possible phone #s.
Explain how you could efficiently implement
Estimation
Simplify & Generalize assignSpecificNum(num) and
assignAnyAvailableNum().
Base Case & Build Array (sorted)? Too slow to remove num.
Linked list? Too slow to find specific num.
Data Structure Hash table? Can’t iterate through free nums.
Brainstorm Tree? Ah-ha!
Product Design
A: Store free #s in BST. Remove when taken.
McDowell | CareerCup.com
49. Technical How To Solve Algorithm Questions
Coding & Algorithms Object Oriented Design System Design
Pattern Matching Compare to similar problems.
Estimation
Simplify & Generalize Solve first for a simplified / tweaked problem.
Base Case & Build
Solve for n = 1, and build solution for n = 2.
Data Structure
Brainstorm Try to apply data structure to solve problem.
Product Design
McDowell | CareerCup.com
50. Technical Whew! All Done!
Coding & Algorithms Object Oriented Design System Design
Pattern Matching
<Gulp> This is a lot of
Estimation
Simplify & Generalize stuff. Do I need to get
everything right?
Base Case & Build
Data Structure
Brainstorm
Product Design
McDowell | CareerCup.com
51. Technical Skills
Evaluation is RELATIVE,
not absolute.
Behavioral
<Gulp> This is a lot of
stuff. Do I need to get
It’s not about how everything right?
quickly you solved
the problem…
Applying
</Gulp>
… it’s about how quickly
you solved it relative to
other candidates.
Process
McDowell | CareerCup.com
52. Technical Skills
So RELAX!
Behavioral
Interviews are supposed to be hard!
Everyone makes mistakes.
Applying
Everyone!
Process
McDowell | CareerCup.com
54. Technical Skills
After Your Interview
• Follow-up with your recruiter
– No response != rejection
Behavioral
• You have no idea how well/poorly you
did.
– Seriously. I know you think you do. But you
don’t.
Applying
• Lots of randomness.
– So if you fail, get up and try again.
Process
McDowell | CareerCup.com
55. Technical Skills
Other Resources
Sold Today CareerCup.com
• Interview Videos
Signed! {ask to add your name too} • iPhone App
• Resume Review
5 stars! • Mock Interviews
Behavioral
today
$15 Or, stalk me online at…
• twitter.com/gayle
• facebook.com/gayle
• technologywoman.com
Applying
• gayle@careercup.com
today
$25
Process
McDowell | CareerCup.com
Editor's Notes
Hashtables – super important!!!
Bit manipulation – super important!Recursion: how does recursion impact space and time?Practice converting from iterative into recursion