Cracking the coding interview u penn - sept 30 2010

Preview:

DESCRIPTION

 

Citation preview

CAREERCUP

Cracking the Technical InterviewGayle Laakmann

Founder / CEO, CareerCup.com

Cracking the Coding Interview

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

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

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

CAREERCUP

How are interviews structured?How are you evaluated?

PROCESS

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

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

Cracking the Coding Interview

Big Company Evaluation

SmartCoding

ExperiencePersonality

and…No Red

Flags

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

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!

CAREERCUP

What do companies look for?

APPLYING

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

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!)

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

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

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

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

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

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

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

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

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!

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!

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

Cracking the Coding Interview

What do companies look for?

INTERVIEW – SOFT SKILLS

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

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

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?

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

Cracking the Coding Interview

How do you tackle hard tech questions?

INTERVIEW – TECH SKILLS

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!

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.

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?

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”

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

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

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!

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++”

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

Cracking the Coding Interview

Standard Coding and Algorithms

Question Type #1

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

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

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

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

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

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

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

Cracking the Coding Interview

Object Oriented Design

Question Type #2

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

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

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

Cracking the Coding Interview

Restaurant OOD

1. Core Objects

#2Object Oriented

Design

GuestPartyServerTable

MealOrder

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”)

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.

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?

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

Cracking the Coding Interview

Large ScaleSystem Design

Question Type #3

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

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

Cracking the Coding Interview

Trivia

Question Type #4

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

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

Cracking the Coding Interview

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

FINAL THOUGHTS

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)

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

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

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

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!

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

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

gayle@careercup.com.

Recommended