cracking the coding interview (master slide deck)
Post on 18-Oct-2014
1.251 views
DESCRIPTION
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 and PM 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.TRANSCRIPT
![Page 1: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/1.jpg)
Cracking the Coding (& PM) Interview
Advice and Strategies for Software Engineering and Product Management Interviews
McDowell | CareerCup.comJanuary 2014
Gayle Laakmann McDowellFounder / CEO, CareerCup.com
Author of Cracking the Coding Interview, Cracking the PM Interview, & The Google Resume
![Page 2: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/2.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
My Background
• Software Engineer @ Google, Microsoft & Apple– 3 Years on Google Hiring Committee– Interviewed 150+ candidates
• Founder of CareerCup.com• Author
– Cracking the Coding Interview – The Google Resume– Cracking the PM Interview [Product Management]
• Interview coach for acquisitions & acquihires
![Page 3: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/3.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
everyone
programmers
![Page 4: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/4.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Most Common CS JobsBig Company Startup Research Start Your
OwnPM Dev SDET Dev Research DO ALL
THE THINGS
Senior & Up
Junior
Sophomore
Freshman
![Page 5: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/5.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
What is a Product Manager?
Product Manager (“PM”)==
“Associate Product Manager” (Google, Yahoo, Facebook, etc.)
==“Program Manager”
(Microsoft)
![Page 6: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/6.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
What is a Product Manager?
• Manage the PRODUCT, not the PEOPLE• “Build a great product for the users”– Who are the users?– What are the features?– When will we launch?– How do we launch?– etc
![Page 7: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/7.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
What is a Programmer?
Programmer==
Software Engineer==
Software Developer (Dev)==
Software Design Engineer (SDE)(Microsoft)
![Page 8: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/8.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
What is a Programmer?
• Write code (duh)• Architect systems• Plus sometimes:– Write specs– Talk to users– Figure out feature set– Etc
![Page 9: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/9.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
What is an SDET?
Software Test Engineer (SET)(Google)
==Software Design Engineer in Test
(SDET)(Microsoft)
!=Quality Assurance (QA)
![Page 10: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/10.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
What is an SDET?
• Figure out what needs to be tested and how
• Write code to automate testing
![Page 11: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/11.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
TODAY
• Software Developer + PM– Experience – Resumes– Interviews– Offers
![Page 12: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/12.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
What to Expect
• 5 - 10 min – Qs about resume• 40 min – technical Qs– Coding and algorithms
• 5 – 10 min – let you ask Qs, general wrap up, etc
![Page 13: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/13.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Big Company Evaluation (Devs)
IntelligenceCodingSkills
PersonalityExperience
Testing aptitude, not knowledge
![Page 14: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/14.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Start-Ups
• Coding + Intelligence• “Hit the ground running”– Do you know “their” technologies?
• Entrepreneurial– Have you started things? – How much direction do you need?
• Personality– Will you fit with the team?
but…it varies!
![Page 15: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/15.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
PM Roles
• Communication Skills• User-Focused Thinking• Passion for Technology• Analytical Skills• Technical Skills (position dependent)
![Page 16: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/16.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
How You Are Judged
How did you do RELATIVEto other candidates on
the SAME question?
… it’s about how quickly you solved it relative to
other candidates.
It’s not about how quickly you solved the problem…
![Page 17: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/17.jpg)
Resumes & Application Process
McDowell | CareerCup.com
![Page 18: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/18.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
How to Get an Interview
• Your “Pedigree”– Education– Work Experience– Projects– Github / Online Profile
• Make a kick-ass resume
![Page 19: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/19.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Did I mention…
PROJECTS???
![Page 20: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/20.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
How We Review Resumes
1. Pull resume out of giant stack2. Spot-check: company names,
positions, projects, schools.3. Skim bullets to see if you’ve
written real code.
InterviewReject
4. Go to next resume & whine about how many more you have left.
“Glanced at,” not
read.15 – 30 seconds
![Page 21: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/21.jpg)
How CS Resume Should Look
Short (1 – 2 line bullets)
3 – 4 ProjectsCourses & independentFinished or unfinished
List of Technical SkillsShort! Cut the “fluff.”
GPA if at least 3.0max (in-major, overall)
One Page Only!Unless > 10 years exp.
A Real Resume Formatwith organized columns
Focus on Accomplishmentsnot responsibilities
Observe: No Objective!Objectives / summaries are
almost always useless.
![Page 22: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/22.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Talking to Recruiters
• Show:– What you’ve done (mobile app? Show it!)– What you’re excited about
• Have a “pitch” ready• Weird is okay– (arrogant is not)
![Page 23: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/23.jpg)
Soft Questions
McDowell | CareerCup.com
![Page 24: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/24.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Goals of Your Answer
• Answer the question.• Deliver a good answer.• Communicate well.– Nugget First– S.A.R.: Situation, Action, Result
![Page 25: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/25.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Preparing for Behavioral Qs
• Create Preparation Grid for ProjectsOS Project Amazon Intern.
Enjoyed
Hated
Most Challenging
Hardest Bug
+ Behavioral Grid [for PM & less tech. roles]
![Page 26: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/26.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Structure 1: Nugget First
• Lead with your “thesis” / nugget– Grabs the listener’s attention– Gives them context for where you’re going.
A: I’m most proud of the way I re-architected the …
Q: What accomplishment are you most proud of?
![Page 27: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/27.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Structure 2: S.A.R.
ituation
ction
esult
S
A
R
What was the issue?
What did you do about it?
What was the impact?
![Page 28: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/28.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Good Questions for Interviewer
• Qs you want to get answered– How decisions get made– Interaction betw devs, PMs, testers
• Qs that show interest / passion– What’s the architecture like?
• Qs that show knowledge / aptitude– How did you solve problem with ___?
Don’t worry too much about this stuff
![Page 29: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/29.jpg)
Technical SkillsInterview Prep
McDowell | CareerCup.com
![Page 30: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/30.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
How to study
• Study the basics– Complex algorithms generally unnecessary.
• Practice solving questions– Don’t memorize!– See: CtCI & CareerCup.com
• Push yourself! • Write code on paper
![Page 31: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/31.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Data Structures
• How to implement• When to use (pros / cons)
Linked Lists Stacks Queues
Trees Tries Graphs
Vectors Heaps Hashtables
![Page 32: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/32.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Algorithms
• Implementation• Space vs. Time
ComplexityQuick Sort Merge Sort
Tree Insert / Find Binary Search
Breadth-First Search
Depth-First Search
![Page 33: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/33.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Concepts
• Not just a concept – know how to code!
Threading Big-O Time / Space
MemoryManagement
Recursion Probability + Combinatorics Bit Manipulation
![Page 34: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/34.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
How to Learn CS Fundamentals?
• Necessary for “elite” tech companies– Not necessarily otherwise (check interview
questions)
• MIT Open Courseware– Freshman / sophomore level DS & Algo courses
• Books– CLRS (Algorithms)
• Online tutorials• Practice implementing and using
![Page 35: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/35.jpg)
Technical SkillsMastering the Interview
McDowell | CareerCup.com
![Page 36: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/36.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Types of “Serious” Questions
1. Product Design Questions 2. Estimation Questions3. Software Engineering Questions– Coding & Algorithms– Object Oriented Design– Scalability– Factual / Trivia / Language-Based
![Page 37: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/37.jpg)
Technical SkillsBehavioralApplying
Process
Product Design Questions
How would you design an calculator for the blind?
Design an elevator for a building.
Pick a Google product. How would you improve it?
![Page 38: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/38.jpg)
Technical SkillsBehavioralApplying
Process
Product Design Questions: Why?
• Communication & Structured Thinking• Ability to understand the user• Creativity• Business instincts / skills
![Page 39: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/39.jpg)
Technical SkillsBehavioralApplying
Process
Product Design Qs: Approach
1. Ask questions to resolve ambiguity2. Understand the user3. Structure the problem4. Solve piece by piece
![Page 40: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/40.jpg)
Technical SkillsBehavioralApplying
Process
Product Design Qs: Example
Step 1: Ask Questions• Adults? Children? Professionals?• Where are they using it?– School, work, etc.
How would you design a calculator for the blind?
![Page 41: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/41.jpg)
Technical SkillsBehavioralApplying
Process
Product Design Qs: Example
Step 2: Understand the User• What’s important to a blind child?– Keeping up with the rest of the class– Not feeling “different”– Efficient input / output
• What about teachers, parents, classmates, etc.?
How would you design a calculator for the blind?
![Page 42: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/42.jpg)
Technical SkillsBehavioralApplying
Process
Product Design Qs: Example
Step 3: Structure• Find a structure– Otherwise, you’re just blabbering
• One approach:1. Make list of functions necessary2. Discuss how to do input / output3. Usability for non-blind4. Summary
How would you design a calculator for the blind?
![Page 43: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/43.jpg)
Technical SkillsBehavioralApplying
Process
Product Design Qs: Example
Step 4: Solve!
How would you design a calculator for the blind?
![Page 44: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/44.jpg)
Technical SkillsBehavioralApplying
Process
Estimation Questions
How many tennis balls can fit in an SUV?
How much money does Gmail make from ads every year?
How much do New Yorkers spend on electricity each year?
![Page 45: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/45.jpg)
Technical SkillsBehavioralApplying
Process
Estimation Qs: Why?
• Problem Solving
• Basic Quantitative Skills
![Page 46: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/46.jpg)
Technical SkillsBehavioralApplying
Process
Estimation Qs: How to Approach
1. Ask questions to resolve ambiguity– Don’t make assumptions (yet)
2. Outline / Structure Your Approach3. Break down the components– Assume numbers when necessary– State assumptions explicitly– Round numbers to make your math easier
4. Sanity Check– Do your numbers make sense?
![Page 47: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/47.jpg)
Technical SkillsBehavioralApplying
Process
Estimation Qs: Example
Step 1: Ambiguous Information• Profit or revenue?• Past year? Or average over history?• Gmail only? Or include Google Apps?
How much money does Gmail make from ads every year?
![Page 48: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/48.jpg)
Technical SkillsBehavioralApplying
Process
Estimation Qs: Example
Step 2: Outline Your Approach(# of users)
x(# clicks / year)
x( $ / click )
How much money does Gmail make from ads every year?
![Page 49: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/49.jpg)
Technical SkillsBehavioralApplying
Process
Estimation Qs: Example
Step 3: Break down componentsEstimate # of Gmail users in the US
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 email3. 80% of those have non-work account… and so on …
How much money does Gmail make from ads every year?
![Page 50: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/50.jpg)
Technical SkillsBehavioralApplying
Process
Estimation Qs: Example
Step 4: Validate Numbers• Could revenue be $5 billion?• No, because…– Google’s annual revenue is ~$40 billion– $16 / US citizen (not just Gmail users)
How much money does Gmail make from ads every year?
![Page 51: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/51.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
CS Questions
• Knowledge Questions• Coding & Algorithms• Object Oriented Design• Scalability
![Page 52: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/52.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Knowledge & Trivia Questions
• Not key focus at “elite” tech companies.– If asked, tends to focus more on DS
knowledge than language knowledge
• If you don’t know, try to deduce the answer– How would language designer do it? etc
![Page 53: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/53.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Coding & Algorithm Questions
1. Understand the question– Clarify, remember key details, etc.
2. Draw an example– “Sufficiently interesting”
3. Talk out loud4. Analyze– Does it work? What’s the big O time / space? – Do YOU understand it?
5. Code (SLOWLY)6. Test + fix (CAREFULLY)
If you’ve heard a question before,
admit it.
![Page 54: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/54.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
What does a “good coder” do?
• Be methodical. Don’t try to rush.• Don’t code if you don’t understand• Reasonably Bug Free– Thorough testing (and careful fixing)– Check for error conditions
• Clean coding– Use other functions– Good use of data structures (define own if useful)– Concise and readable
![Page 55: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/55.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Whiteboard Coding Tips
• Code in the FAR top left corner• Write small & straight• Pseudocode if you’d like• Use arrows to insert new code snippets• Use “good” variable names, then
abbreviate• “Breadth-First” Coding
![Page 56: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/56.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
“Breadth-First” Coding
• Divide problems into sub-components– Modularize & Structure
• Ex: Ransom Note– Write as one big function?– OR… modularize!
![Page 57: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/57.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Ex: Ransom Note: “Depth-First” Coding
![Page 58: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/58.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Ex: Ransom Note: “Breadth-First” Coding
![Page 59: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/59.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Ex: Ransom Note: “Breadth-First” Coding
![Page 60: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/60.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Ex: Ransom Note: “Breadth-First” Coding
![Page 61: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/61.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Ex: Ransom Note: “Breadth-First” Coding
![Page 62: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/62.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
“Breath-First” Coding
• “Depth-First” Coding (One big function)– Messy– Time consuming– Poor coding style
• “Breadth-First” Coding (Modularized)– “Finishes” algorithm immediately– Often allows you to skip details– Easier to test & fix issues– Demonstrates good coding style– Keeps YOU organized
![Page 63: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/63.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Common Mistakes
• Ignoring information given• Not using examples– To design algorithms– While writing code
• “Pushing through” code when confused– Incoherent thoughts -> incoherent code
• Diving into code too quickly• The details:– Off-by-one, < vs <=, division (and any math)
![Page 64: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/64.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Types of Interview Questions
Coding & Algorithms
Object Oriented Design System Design
“Reverse a Linked List”
“Design a Parking Lot”
“Design a Web Crawler”
![Page 65: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/65.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Types of Interview QuestionsCoding & Algorithms
Pattern Matching
Simplify & Generalize
Base Case & Build
Data Structure Brainstorm
Object Orient
ed Design
System
Design
![Page 66: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/66.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Algorithm Qs: Pattern Matching
Q: Write code to reverse the order of words in a sentence. “dogs are cute” “cute are dogs”
Similar to: reverse characters in a string. “dogs are cute” “etuc era sgod”
A: Reverse full string, then reverse each word.
Coding & Algorithms
Pattern Matching
Simplify & Generalize
Base Case & Build
Data Structure Brainstorm
Object Orient
ed Design
System
Design
![Page 67: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/67.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Algorithm Qs: Simplify & GeneralizeCoding & Algorithms
Pattern Matching
Simplify & Generalize
Base Case & Build
Data Structure Brainstorm
Object Orient
ed Design
System
Design
Q: Design algorithm to figure out if you can build a ransom note (array of strings) from a magazine (array of strings).
Simplify: what if we used characters instead of strings? Build array of character frequencies.
Generalize: how we can extend answer to words?
A: Build hashtable from word to frequency.
![Page 68: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/68.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Algorithm Qs: Base Case & BuildCoding & Algorithms
Pattern Matching
Simplify & Generalize
Base Case & Build
Data Structure Brainstorm
Object Orient
ed Design
System
Design
Q: Design algorithm to print subsets of set. {a, b, c} {}, {a}, {b}, {c}, {a, b},
{a, c}, {b, c}, {a, b, c}
S({}) {}S({a}) {}, {a}S({a, b}) {}, {a}, {b}, {a, b}S({a, b, c}) ?
A: Build S(n) by cloning S(n-1) and adding n to the cloned sets.
![Page 69: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/69.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Algorithm Qs: Data Structure BrainstormCoding & Algorithms
Pattern Matching
Simplify & Generalize
Base Case & Build
Data Structure Brainstorm
Object Orient
ed Design
System
Design
Q: There are 10^10 possible phone #s. Explain how you could efficiently implement assignSpecificNum(num) and assignAnyAvailableNum().
Array (sorted)? Too slow to remove num.Linked list? Too slow to find specific num.Hash table? Can’t iterate through free nums.Tree? Ah-ha!
A: Store free #s in BST. Remove when taken.
![Page 70: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/70.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Coding & Algorithms
Pattern Matching
Simplify & Generalize
Base Case & Build
Data Structure Brainstorm
Object Orient
ed Design
System
Design
How To Solve Algorithm Questions
Compare to similar problems.
Solve first for a simplified / tweaked problem.
Solve for n = 1, and build solution for n = 2.
Try to apply data structure to solve problem.
![Page 71: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/71.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Object Oriented Design
Handle AmbiguityWhat about the question is ambiguous?
Design the Core ObjectsWhat are the main objects in the system?
Analyze RelationshipsHow are the objects related to each other?
Investigate ActionsWhat are the main operations?
Coding & Algorithms
Object Oriented Design System Design
![Page 72: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/72.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Coding & Algorithms
Object Oriented Design System Design
Object Oriented Design
Handle AmbiguityIs it a single restaurant, or part of a chain?
Design the Core ObjectsGuest, Party, Table, Server, Host, …
Analyze RelationshipsServer and Host are both Employees…
Investigate ActionsA Party is seated at a Table by a Host…
How would you design the data structures and objects for a restaurant?
![Page 73: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/73.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
System Design
Handle AmbiguityWhat about the question is ambiguous?
Make BelievePretend there wasn’t so much data & solve
Get RealGo back to the real problem. What breaks?
Solve ProblemsSolve the issues you just found.
Coding & Algorithms
Object Oriented Design System Design
![Page 74: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/74.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
System Design
Handle AmbiguityDo the words need to be in a specific order?
Make BelieveAssume everything can fit on one machine.
Get RealMust split up data across machines.
Solve ProblemsDivide hash table by file or by keyword?
Given millions of documents, find all documents
which contain a list of words.
Coding & Algorithms
Object Oriented Design System Design
![Page 75: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/75.jpg)
McDowell | CareerCup.com
Technical
Estimation
Product Design
Whew! All Done!
<Gulp> This is a lot of stuff. Do I need to get
everything right?
Coding & Algorithms
Pattern Matching
Simplify & Generalize
Base Case & Build
Data Structure Brainstorm
Object Orient
ed Design
System
Design
![Page 76: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/76.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
<Gulp> This is a lot of stuff. Do I need to get
everything right?
</Gulp>
Evaluation is RELATIVE, not absolute.
… it’s about how quickly you solved it relative to
other candidates.
It’s not about how quickly you solved the problem…
![Page 77: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/77.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
So RELAX!Interviews are supposed to be hard!
Everyone makes mistakes. Everyone!
![Page 78: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/78.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
After Your Interview
• Follow-up with your recruiter – No response != rejection
• You have no idea how well/poorly you did.– Seriously. I know you think you do. But you
don’t.
• Lots of randomness.– So if you fail, get up and try again.
![Page 79: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/79.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Negotiation
![Page 80: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/80.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
But I hate negotiating!
• Welcome to the club!• You ARE in demand.• Your offer will not be revoked.
Is this conversation SO terrible thatyou’re willing to give up $1000+**?
** and likely more
![Page 81: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/81.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Negotiation
• Most->least negotiable (generally)1. Signing bonus/relocation2. Stock3. Salary4. Other benefits
• Easier if you have another offer• Counter-offer• What matters to you?
![Page 82: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/82.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Closing Advice
• Do projects• Study for your interviews• Chase interviews• … but don’t chase money• If possible, go to an “elite” tech company– (But don’t stay too long if that’s not what
you want!)
• Check-in on your career.– Is this what you want to do with your life?
![Page 83: Cracking the Coding Interview (Master Slide Deck)](https://reader034.vdocuments.net/reader034/viewer/2022050904/5442db88b1af9f130d8b47b2/html5/thumbnails/83.jpg)
McDowell | CareerCup.com
Technical SkillsBehavioralApplying
Process
Other ResourcesCareerCup.com• Interview Videos• Resume Review• Mock Interviews
Or, follow me online at…• twitter.com/gayle• facebook.com/gayle• technologywoman.com• [email protected]• quora.com