cracking the oding interview code chix - oct 2012

55
Cracking the Coding Interview Advice and Strategies for Software Engineering and PM Interviews McDowell | CareerCup.com | Women Who Code Aug 2012 Gayle Laakmann McDowell Founder / CEO, CareerCup.com Author of The Google Resume and Cracking the Coding Interview

Post on 18-Oct-2014

492 views

Category:

Documents


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Cracking the oding interview   code chix - oct 2012

Cracking the Coding Interview

Advice and Strategies for Software Engineering and PM Interviews

McDowell | CareerCup.com | Women Who CodeAug 2012

Gayle Laakmann McDowellFounder / CEO, CareerCup.com

Author of The Google Resume and Cracking the Coding Interview

Page 2: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

My Background

• Software Engineer @ GOOG, MS & Apple– 3 Years on Google Hiring Committee– Interviewed 150+ candidates

• Founder of CareerCup.com– 8000+ tech interview questions

• Author– Cracking the Coding Interview – The Google Resume

Page 3: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

Slides Posted Online

posted at:www.technologywoman.com

Click “Speaking Engagements”

Page 4: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

Process

Evaluation

Structure

Applying

Experience

Resume

Soft Skills

Preparation

Interview

Tech Skills

Preparation

Interview

Page 5: Cracking the oding interview   code chix - oct 2012

Interview Process

McDowell | CareerCup.com

Page 6: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

“Elite” Tech Companies

IntelligenceCodingSkills

PersonalityExperience

Testing aptitude, not knowledge

Page 7: Cracking the oding interview   code chix - oct 2012

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 8: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

PM Roles

• Communication Skills• User-Focused Thinking• Passion for Technology• Analytical Skills• Technical Skills (position dependent)

Page 9: Cracking the oding interview   code chix - oct 2012

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 10: Cracking the oding interview   code chix - oct 2012

Resumes & Application Process

McDowell | CareerCup.com

Page 11: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

How to Get an Interview

• Your “Pedigree”– Education– Work Experience– Projects– Github / Online Profile

• Make an awesome resume

Page 12: Cracking the oding interview   code chix - oct 2012

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 13: Cracking the oding interview   code chix - oct 2012

How CS Resume Should Look

Short (1 – 2 line bullets)

3 – 4 ProjectsCourses & independentFinished or unfinished

List of Technical Skills

Short! 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 14: Cracking the oding interview   code chix - oct 2012

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 15: Cracking the oding interview   code chix - oct 2012

Behavioral Questions

McDowell | CareerCup.com

Page 16: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

Communication Goals

• Answer the question.• Deliver a *good* answer.• Communicate well.

Page 17: Cracking the oding interview   code chix - oct 2012

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 18: Cracking the oding interview   code chix - oct 2012

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 19: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

Structure 2: S.A.R.

ituationctionesult

SAR

What was the issue?

What did you do about it?

What was the impact?

Page 20: Cracking the oding interview   code chix - oct 2012

Technical SkillsInterview Prep

McDowell | CareerCup.com

Page 21: Cracking the oding interview   code chix - oct 2012

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 22: Cracking the oding interview   code chix - oct 2012

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 23: Cracking the oding interview   code chix - oct 2012

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 24: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

Concepts

• Not just a concept – know how to code!

Threading System Design & Scalability

MemoryManagement

Recursion Probability + Combinatorics Bit Manipulation

Page 25: Cracking the oding interview   code chix - oct 2012

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 26: Cracking the oding interview   code chix - oct 2012

Technical SkillsMastering the Interview

McDowell | CareerCup.com

Page 27: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical

Estimation

Product Design

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 28: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 29: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

Product Design Questions: Why?

• Communication & Structured Thinking• Ability to understand the user• Creativity• Business instincts / skills

Page 30: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

Product Design Qs: Approach

1. Ask questions to resolve ambiguity2. Understand the user3. Structure the problem4. Solve piece by piece

Page 31: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 32: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 33: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 34: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

Product Design Qs: Example

Step 4: Solve!

How would you design a calculator for the blind?

Page 35: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 36: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

Estimation Qs: Why?

• Problem Solving

• Basic Quantitative Skills

Page 37: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 38: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 39: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 40: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 41: Cracking the oding interview   code chix - oct 2012

Technical

Estimation

Product Design

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 42: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical

Estimation

Product Design

How to Solve Tough Problems

1. Ask Questions!– Questions are more ambiguous than they appear

2. Talk out loud– Show us how you think

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– And make CAREFUL fixes.

Page 43: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical

Estimation

Product Design

What does a “good coder” do?

• Code in top-left of whiteboard• Pseudocode first (if necessary)• Be methodical. Don’t try to rush.• 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 44: Cracking the oding interview   code chix - oct 2012

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 45: Cracking the oding interview   code chix - oct 2012

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 46: Cracking the oding interview   code chix - oct 2012

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 47: Cracking the oding interview   code chix - oct 2012

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 48: Cracking the oding interview   code chix - oct 2012

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 49: Cracking the oding interview   code chix - oct 2012

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 50: Cracking the oding interview   code chix - oct 2012

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 51: Cracking the oding interview   code chix - oct 2012

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 52: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

So RELAX!Interviews are supposed to be hard!

Everyone makes mistakes. Everyone!

Page 53: Cracking the oding interview   code chix - oct 2012

Final Thoughts

McDowell | CareerCup.com

Page 54: Cracking the oding interview   code chix - oct 2012

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 55: Cracking the oding interview   code chix - oct 2012

McDowell | CareerCup.com

Technical SkillsBehavioralApplying

Process

Other ResourcesSold TodaySigned! {ask to add your name too}

CareerCup.com• Interview Videos• iPhone App• Resume Review• Mock Interviews

today$15 Or, stalk me online at…

• twitter.com/gayle• facebook.com/gayle• technologywoman.com• [email protected]

today$25

5 stars!