Cracking the coding interview columbia - march 23 2011
description
Transcript of Cracking the coding interview columbia - march 23 2011
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• CS undergrad and masters degree from UPenn• Ex-Engineer at Google, Microsoft and Apple– plus Offers from Amazon, IBM and others– 3 Years on Google Hiring Committee– Interviewed 150+ candidates
• Founder of CareerCup.com• Author of Cracking the Coding Interview and
The Google Resume
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Process
Evaluation
Structure
Applying
Experience
Resume
Soft Skills
Preparation
Interview
Tech Skills
Preparation
Interview
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
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Big Company Evaluation
SmartCoding
ExperiencePersonality
Testing aptitude, not
knowledge
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
and…No Red
Flags
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– Part-time job– Start a business!
• Know C++ or Java well• Good grades are nice – but not enough!
Skills PassionWork EthicCreativityInitiative
But unless you show this on your resume, it really doesn’t do you much good.
So what should a resume look like?
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Resumes – The Most Important Thing• Glanced at, not read– You have 15 – 30 seconds to make the best
impression possible.
• Show That You “Get Things Done”
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Resumes: Structure1. One Page2. Short Bullets: 1 – 2 lines– “So short that you can’t NOT but read it”
3. Nice Resume Format– Use tables, not spaces.– Use a REAL resume format.
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Resumes: Content1. Accomplishments, not responsibilities– Quantify!
2. Understandable, but specific– To be read by both recruiters and engineers
3. PROJECTS!– Anything (esp. coding) you did – for class or not
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
How do you make yourself look good?
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)
• Prepare for questions about yourself
But how?
Soft Skills Prep
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
How to handle “soft skills” questions
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 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
• Write code on paper– Put away the compiler
• Study the basics: – CLR algorithms book is great –
but too complex for interviews• 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 Probability + 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
How do you tackle hard tech questions?
INTERVIEW – TECH SKILLS
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Interview Coding
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Mastering the Coding 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
What does a “good coder” do?• Be methodical, not speed• Reasonably Bug Free– Thorough testing (and careful fixing)– Check for error conditions
• Clean coding– Uses other functions– Good use of data structures (defines own if
useful)– Concise and readable
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Solving Interview Problems
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
3 Main Question Types• Standard Coding and Algorithms– “Reverse a linked list”
• Object Oriented Design– “Design a parking lot”
• Scalability– “Design a program to crawl the web”
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Algorithms
Question Type #1
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
How To Solve Algorithm Questions
• 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
Design an algorithm to figure out if you can build a ransom note (array of strings) from a magazine (array of strings).
#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?
Object Oriented Design 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
Core objectsrestaurant, host, employee, server, table
Relationshipseach party has many guests, server and host are a type of employee
InteractionsHOST assigns PARTY to TABLE
AlgorithmsHow is a free table selected?
Object Oriented Design Steps (C.R.I.A.) #2Object Oriented
Design
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Scalability
Question Type #3
Process Applying Prep (Soft) Prep (Tech) Interview (Soft) Interview (Tech)
Cracking the Coding Interview
Simplifypretend there wasn’t a lot of data. How would you solve it?
Identify the problemswhat goes wrong when you have lots of data?
Fix the issuessolve the issues that come up
Iteratenew problems may have come up. How do you solve them?
Scalability Questions #3Scalability
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
(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
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
• Books (sold today - $20)• Interview video• Mock Interviews• Resume Review
Other Resources
Slides posted at CareerCup.com/slides