cracking the coding interview u penn - sept 30 2010

61
CAREERCUP Cracking the Technical Interview Gayle Laakmann Founder / CEO, CareerCup.com Cracking the Coding Interview

Post on 18-Oct-2014

4.507 views

Category:

Documents


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Cracking the coding interview   u penn - sept 30 2010

CAREERCUP

Cracking the Technical InterviewGayle Laakmann

Founder / CEO, CareerCup.com

Cracking the Coding Interview

Page 2: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

My Background• Penn BSE / MSE ‘05 in CS• Ex-Engineer at Google, Microsoft and Apple

+ Offers from Amazon, IBM and others• 3 Years on Google Hiring Committee• Interviewed 150+ candidates

Page 3: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

CareerCup• Founded 2005• Largest source for technical interview

questions (3000+ FREE questions)• Services:– Book (Cracking the Coding Interview)– Video of interview– Resume review– Mock interviews

Page 4: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Process

Evaluation

Structure

Applying

Experience

Resume

Interview Prep

Soft Skills

Tech Skills

Interview

Soft Skills

Tech Skills

Page 5: Cracking the coding interview   u penn - sept 30 2010

CAREERCUP

How are interviews structured?How are you evaluated?

PROCESS

Page 6: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Technical Interview Process• Initial Screen (Phone / Campus)• 4 - 5 on site interviews– 10 min General– 40 min Technical– 10 min Closing

• Sometimes “blind” interview

Page 7: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Big Company Evaluation

SmartCoding

ExperiencePersonality

and…No Red

Flags

Page 8: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

What are red flags?• Arrogance• Communication Issues• Arguing (too much)• Dishonesty

Page 9: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Smaller Companies• Tend to look for broader skills• Care more about experience / personality• Might ask to see “portfolio”

but…It varies!

Page 10: Cracking the coding interview   u penn - sept 30 2010

CAREERCUP

What do companies look for?

APPLYING

Page 11: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

What can you do?• Get project experience!– Course work– Open source– Independent studies– Weiss Tech House– Part-time job– Start a business!

• Know C++ or Java well• Good grades are nice – but not enough!

Skills PassionWork EthicCreativityInitiative

Page 12: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

3 Hallmarks of a Great Resume:1. Short and sweet– One page – no more!– Short bullets (1 – 2 lines). No paragraphs!

2. Accomplishments, not responsibilities– Quantify!

3. Clean, Professional and Well Structured– Projects section– No spelling / grammar mistakes– Nice resume format (don’t format via spaces!)

Page 13: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Why do you want to work here? What was your favorite project?

INTERVIEW PREP – SOFT SKILLS

Page 14: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

• Research the company / team• Prepare questions (around 10)• Know:– What they do (duh)– Specific products – what is good / bad– What their hardest problems are– Why you want to work there– What value you can add (esp. if non-coding role)

Soft Prep – The Company / Team

Page 15: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

• Create Preparation Grid for ProjectsOS Project Internship

Enjoyed

Hated

Most Challenging

Hardest Bug

+ (maybe) Behavioral Grid

Soft Prep – Yourself

Page 16: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

• Strengths vs. Weaknesses• Mediocre answer: “it was hard because I had

to learn new languages / technologies”• Not just answering Q’s – show who you are!

Soft Prep – Yourself

Page 17: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

How do you prep for coding questions?What do you prep?

INTERVIEW PREP – TECH SKILLS

Page 18: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

• Study the basics: – CLR algorithms book is great –

but too complex for interviews• Write code on paper– Put away the compiler

• Look up sample interview questions– Focus on the topics you’re struggling with

How to study

Page 19: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

• How to implement• When to use (pros / cons)

Data Structures

Linked Lists Stacks Queues

Trees Tries Graphs

Vectors Heaps HASHTABLES

Page 20: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

• Implementation• Space vs Time Complexity

Algorithms

With eyes closed: With some thought:

Breadth-First Search Mergesort

Depth-First Search Quicksort

Tree Insert / Find Binary search

Page 21: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Concepts

Threading Locks + Mutexes

MemoryManagement

Recursion Randomness+ Combinatorics

Bit Manipulation

• Not just a concept – know how to code!

Page 22: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Code on Paper

Type Up As-Is

Learn from

Mistakes

Don’t practice on computer!

Page 23: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

What do companies look for?

INTERVIEW – SOFT SKILLS

Page 24: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Communication Tips• Be specific – not arrogant

“Yeah, I did all the hard work for the team” “I implemented the file system, which was considered one of the hardest components.”

• Be concise and structured– Nugget First– S.A.R.: Situation, Action, Result

Page 25: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

• Lead with your “thesis” / nugget– Nuggets grab the listener’s attention, and tell

them where you’re going

• Q: What accomplishment are you most proud of?

• A: The time that I convinced the engineering school to switch to paperless time logs.

Structure 1: Nugget First

Page 26: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

ituationctionesult

Structure 2: S.A.R.

SAR

What did you do? What should I care?

Page 27: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

How do you tackle hard tech questions?

INTERVIEW – TECH SKILLS

Page 28: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Mastering the Technical Questions1. 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– You’re not done until they say you’re done!

Page 29: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Step 1: Ask Questions• What are the data types?• How much data?• What assumptions do you need?• Who is the user?• NOTE: Especially important at Microsoft.

Page 30: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Step 2: Think Critically• What’s space / time complexity?• What if there’s lots of data?• Does your design cause other issues?• If there are other issues, did you make the

right trade offs?

Page 31: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Step 3: Talk Out Loud• Approach is more important than answer• Talking out loud:– Shows us how you think– Lets the interviewer guide you– Makes you not appear “stuck”

Page 32: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Step 4: Pseudo Code & Code• Pseudo code first – but say that!• Use data structures generously– What are the right ones?– Define your own = shows good style

• Don’t crowd your coding– Start in the upper left corner of board, not bottom

Page 33: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Step 5: Testing• Test your code!– Extreme cases– Check for user error– Test general cases

• CAREFULLY FIX MISTAKES

Page 34: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

RELAX!Interviews are

supposed to be hard!

Everyone makes mistakes. Everyone!

Page 35: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Question Types• Standard Coding and Algorithms– “Reverse a linked list”

• Object Oriented Design– “Design a parking lot”

• Large System Design– “Design a program to crawl the web”

• Trivia– “What does a “vtable” refer to in C++”

Page 36: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Standard Coding and Algorithms

Question Type #1

Page 37: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

OMG! I have no idea how to solve this problem!

Algorithm Generation #1Standard Coding and Algorithms

Page 38: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Algorithm Generation• Pattern Matching– What problem is this similar to?

• Simplify / Generalize– What if the data was a different type?

• Base Case & Build– Can you do this just for element 1? 1 and 2? …

• Data Structure Brainstorm– Go through all data structures – can they help?

#1Standard Coding and Algorithms

Page 39: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Algorithm Generation• Pattern Matching

Write code to reverse the order of words in a sentence.Example:

input: “she ran to the store”output: “store the to ran she”

#1Standard Coding and Algorithms

Page 40: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Algorithm Generation• Simplify / Generalize

Write a program to remove the duplicate characters in a string without using any additional buffers.

#1Standard Coding and Algorithms

Page 41: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Algorithm Generation• Base Case & Build

Design an algorithm to print all subsets of a set (e.g., the power set)Example:

input: {a, b, c}output: {{}, {a}, {b}, {c}, {a, b}, {a, c},

{b, c}, {a, b, c}}

#1Standard Coding and Algorithms

Page 42: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Algorithm Generation• Data Structures Brainstorm

Design an algorithm to figure out if someone has won a game of tic-tac-toe. Make it as fast as possible.

#1Standard Coding and Algorithms

Page 43: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Object Oriented Design

Question Type #2

Page 44: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Core objectswhat are the core objects?

Relationshipswhat is their relationship to each other?

Interactionshow do they interact?

Algorithmswhat are the tricky / interesting algorithms?

OOD Steps (C.R.I.A.) #2Object Oriented

Design

Page 45: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

OOD Example

Design the data structures for a restaurant

#2Object Oriented

Design

Page 46: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Restaurant OOD

1. Core Objects

#2Object Oriented

Design

GuestPartyServerTable

MealOrder

Page 47: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Restaurant OOD

2. Relationships

#2Object Oriented

Design

Each party has many guests. Each guest has one party. (“One to many”)

Page 48: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Restaurant OOD

3. Interactions

#2Object Oriented

Design

Party enters with Guest(s). Host assigns Party to Table.

Page 49: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Restaurant OOD

4. Algorithms

#2Object Oriented

Design

How do you find a free table?

Page 50: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Large ScaleSystem Design

Question Type #3

Page 51: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Large Scale Steps

Solve for simple case (less data)

#3Large Scale

System Design

Simplify Generalize

Generalize to more data: find & solve problems

Page 52: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Trivia

Question Type #4

Page 53: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Trivia1. Hopefully you know the answer!

A. Practice more 2. Else…

A. Admit that you don’t knowB. Try to derive the answer

#4Trivia

Page 54: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

(eg, things that wouldn’t fit in elsewhere)

FINAL THOUGHTS

Page 55: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

The Interview: Ending It• Smile, be positive• If you think you bombed, don’t worry• Follow up with your recruiters (sometimes

they forget)

Page 56: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

The Offer• It’s always negotiable– Helps if you have competing offer– Don’t lie – companies know what competitors

offer– Negotiate on multiple factors (salary, signing

bonus, stock, etc)• Is it really what you want?– Money, career options, etc

Page 57: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

My Red Flags: People who…… didn’t test their code… found mistakes and would make random fixes… messy code (lack of data structures /

redundant code)… didn’t consider the impact of their algorithms… were scared to try

Page 58: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Take Aways – Getting Ready• Get Project Experience• Show project experience on resume• S. A. R. (Situation Action Result)• Prepare Project / Behavioral Grids

Page 59: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Technical Interview Prep• Things to know (data structures, algorithms,

concepts)– Simple Know Implementation– Complex Know Concepts

• Practice interview questions!

Page 60: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

At The Interview• Be nice• RELAX! Interviews are supposed to be hard• Approaches– Pattern Matching– Simplify / Generalize– Base Case & Build– Data Structure Brainstorm

Page 61: Cracking the coding interview   u penn - sept 30 2010

Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)

Cracking the Coding Interview

Other Resources• Book (sold today - $20)• Interview video• Mock Interviews• Resume Review• Slides posted at CareerCup.com/slides

#1 book for interviewing on Amazon!

PS: CareerCup is hiring a part-time dev!(remember that part about needing coding experience?)If you know Ruby on Rails (or even if you don’t), contact

[email protected].