SlideShare une entreprise Scribd logo
1  sur  43
GayleL.McDowell | Founder/ CEO
gayle in/gaylemcdgayle
Cracking the
Coding Interview
CareerCup
gayle in/gaylemcdgayleGayle Laakmann McDowell 2
Hi! I’m Gayle LaakmannMcDowell
Author Interview Coach Interview Consulting
<dev> </dev>
(CS) (MBA)
What We Look
For
Things that make you think
01
Gayle Laakmann McDowell 4gayle in/gaylemcdgayle
Why?
Analytical skills
How you think
Make tradeoffs
Pushthrough hard
problems
Communication
Strong CS fundamentals
gayle in/gaylemcdgayle 5
z
Gayle Laakmann McDowell
What
is NOT
expected
To know the answers
To solve immediately
To code perfectly
(It’snice.Itjustdoesn’t
happen*.)
*Okayfine.Ithappenedonce,in2000+hiringpackets.
gayle in/gaylemcdgayle 6
z
Gayle Laakmann McDowell
What
IS
expected
Be excitedabout hard problems
Drive!
 Keep trying when stuck
 More than just “correct”
Pay attention to me!
Write real code
Showmehowyouthink!
Preparation
02
gayle in/gaylemcdgayleGayle Laakmann McDowell 8
Essential Knowledge
Data Structures Algorithms Concepts
ArrayLists Merge Sort BigO Time
Hash Tables QuickSort BigO Space
Trees(+Tries) & Graphs Breadth-FirstSearch Recursion
LinkedLists Depth-FirstSearch Memoization/ Dynamic
Programming
Stacks/ Queues BinarySearch
Heaps
gayle in/gaylemcdgayleGayle Laakmann McDowell 9
Preparation
MASTER Big O
ImplementDS/Algorithms
Practicewith interview questions
Code on paper/whiteboard
Mock interviews
PUSHYOURSELF!
7 Steps
Things that make you think
03
gayle in/gaylemcdgayle 11
z
Gayle Laakmann McDowell
How
To
Approach
CrackingTheCodingInterview.com“Resources”
gayle in/gaylemcdgayle 12Gayle Laakmann McDowell
step
Listen (for clues)
gayle in/gaylemcdgayle 13Gayle Laakmann McDowell
step
Draw an Example
INTERSECTION SIZE: Find #
elementsin common between
two sorted, distinct arrays:
gayle in/gaylemcdgayleGayle Laakmann McDowell 14
Ex:Intersection ofTwo Sorted Arrays
Most people draw somethinglike this:
[1, 12, 15, 19]
[2, 12, 13, 20]
 Toosmall
 Toospecial-case-y
• same size, one commonelement, same index
gayle in/gaylemcdgayleGayle Laakmann McDowell 15
Ex:Intersection ofTwo Sorted Arrays
Better:
[1, 12, 15, 19, 20, 21]
[2, 15, 17, 19, 21, 25, 27]
 Big
 No specialcases
gayle in/gaylemcdgayle 16Gayle Laakmann McDowell
step
Draw an Example
Big Enough
General Purpose
+
gayle in/gaylemcdgayle 17Gayle Laakmann McDowell
step
Brute Force / Naive
Stupid&terribleisokay!
gayle in/gaylemcdgayle 18Gayle Laakmann McDowell
step
Optimize
Walk through brute
force
Look for optimizations
Gayle Laakmann McDowell 19gayle in/gaylemcdgayle
Techniquesto Develop Algorithms
BUD
Space andTime
Do It Yourself
Gayle Laakmann McDowell 20gayle in/gaylemcdgayle
(A) Look for BUD
Bottlenecks
Unnecessary work
Duplicated work
Gayle Laakmann McDowell 21gayle in/gaylemcdgayle
What’s the bottleneck?
 Ex: countingthe intersection
[1, 12, 15, 19, 20, 21]
[2, 15, 17, 19, 21, 25, 27]
 Brute Force: O(A * B)
  Bottleneck:O(B) tosearch
 Binary Search Algorithm: O(A log B)
  Bottleneck:O(logB)tosearch
 Sorted Merge: O(A + B) B
Gayle Laakmann McDowell 22gayle in/gaylemcdgayle
What’s unnecessary?
 Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000
 Unnecessary: looking for d
U
Gayle Laakmann McDowell 23gayle in/gaylemcdgayle
What’s unnecessary?
 Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000
 Unnecessary: looking for d
U
Gayle Laakmann McDowell 24gayle in/gaylemcdgayle
What’s duplicated?
 Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000
 Duplicated: c, d pairs
D
Gayle Laakmann McDowell 25gayle in/gaylemcdgayle
What’s duplicated?
 Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000
 Duplicated: c, d pairs
D
c d c3 + d3
… … …
4 31 29855
4 32 32832
4 33 36001
… … …
5 59 205504
5 60 216125
5 61 227106
… … …
Gayle Laakmann McDowell 26gayle in/gaylemcdgayle
What’s duplicated?
 Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000
 Duplicated: c, d pairs
D
c3 + d3 (c, d)
… …
29855 (4, 31)
32832 (4, 32),(18, 30)
36001 (4, 33)
… …
205504 (5, 59)
216125 (5, 60),(45, 50)
227106 (5, 61)
… …
Gayle Laakmann McDowell 27gayle in/gaylemcdgayle
What’s duplicated?
 Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000
D
Gayle Laakmann McDowell 28gayle in/gaylemcdgayle
(B)Space/TimeTradeoffs
Hashtables & other datastructures
Precomputing
Gayle Laakmann McDowell 29gayle in/gaylemcdgayle
(C)Do it yourself
Findpermutationsof swithinb
gayle in/gaylemcdgayleGayle Laakmann McDowell 30
find abbcd in
b a b c d b a e f d b b a c b d d f a e
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Gayle Laakmann McDowell 31gayle in/gaylemcdgayle
(C)Do it yourself
Findpermutationsof swithinb
 s = abbcd
 b =
Findthem!
 … now how didyou actuallydoit?
b a b c d b a e f d b b a c b d d f a e
Gayle Laakmann McDowell 32gayle in/gaylemcdgayle
Techniquesto Develop Algorithms
BUD
Space and Time
Do It Yourself
gayle in/gaylemcdgayle 33Gayle Laakmann McDowell
step
Walk Through
Know the variables
andwhen they change
gayle in/gaylemcdgayle 34Gayle Laakmann McDowell
step
Write Beautiful Code
Gayle Laakmann McDowell 35gayle in/gaylemcdgayle
How toWrite WhiteboardCode
Top-leftcorner
Short Hand Helps
Good style
Modularize (upfront!)
Gayle Laakmann McDowell 36gayle in/gaylemcdgayle
ShortHandHelps
Good:
Good Enough &Easier:
gayle in/gaylemcdgayleGayle Laakmann McDowell 37
Good Style
Appropriate & ConsistentSpacing
Good Variable Names
BAD
gayle in/gaylemcdgayleGayle Laakmann McDowell 38
Modularization
gayle in/gaylemcdgayle 39Gayle Laakmann McDowell
step
Testing
FIRST Analyze
 What’s it doing? Why?
 Anything that looks weird?
 Errorhot spots
THEN use test cases
 Small test cases
 Edge cases
 Biggertest cases
BUT…
 Test code, notalgorithm
 Think as you test
 Think before you fix
gayle in/gaylemcdgayle 40
z
Gayle Laakmann McDowell
How
To
Approach
CrackingTheCodingInterview.com“Resources”
If you forget
everything else
Please remember this
04
gayle in/gaylemcdgayleGayle Laakmann McDowell 42
Please please please please
Create example
 Big (tinyisuseless)
 Generic(nota specialcase)
Walkthrough it
 Figureouttheoutputforthatoneinput
 (Don’tworryaboutalgorithms/ implementation)
DO NOT CODE UNTIL YOU’RE READY
 100%surethatyouknowwhatyou’redoing
 100%surethatyourinterviewwantsyoutocode
gayle in/gaylemcdgayleGayle Laakmann McDowell 43
Other Resources
Gayle.com
CareerCup.com
CrackingThe
CodingInterview.com
Or, follow me online
• facebook.com/gayle
• twitter.com/gayle
• gayle.com
• gayle@gayle.com
• quora.com

Contenu connexe

Tendances

The Owl House - Eclipse Lake - Ending
The Owl House - Eclipse Lake - EndingThe Owl House - Eclipse Lake - Ending
The Owl House - Eclipse Lake - EndingKing Pecora
 
Building a Directed Graph with MongoDB
Building a Directed Graph with MongoDBBuilding a Directed Graph with MongoDB
Building a Directed Graph with MongoDBTony Tam
 
The Owl House - Eclipse Lake - Cold open
The Owl House - Eclipse Lake - Cold open The Owl House - Eclipse Lake - Cold open
The Owl House - Eclipse Lake - Cold open King Pecora
 
db2dart and inspect
db2dart and inspectdb2dart and inspect
db2dart and inspectdbawork
 
CSS For Backend Developers
CSS For Backend DevelopersCSS For Backend Developers
CSS For Backend Developers10Clouds
 
The Owl House - Hunting Palismen - Ending
The Owl House - Hunting Palismen - EndingThe Owl House - Hunting Palismen - Ending
The Owl House - Hunting Palismen - EndingKing Pecora
 
MariaDB Galera Cluster presentation
MariaDB Galera Cluster presentationMariaDB Galera Cluster presentation
MariaDB Galera Cluster presentationFrancisco Gonçalves
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerMydbops
 
Tema 2 fracciones ejercicios
Tema 2 fracciones ejerciciosTema 2 fracciones ejercicios
Tema 2 fracciones ejerciciospradob9
 
The Owl House - Hunting Palismen - Palismen adoption day
The Owl House - Hunting Palismen - Palismen adoption dayThe Owl House - Hunting Palismen - Palismen adoption day
The Owl House - Hunting Palismen - Palismen adoption dayKing Pecora
 
Scala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowScala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowLightbend
 
The Owl House - Echoes of the Past - Beach
The Owl House - Echoes of the Past - Beach The Owl House - Echoes of the Past - Beach
The Owl House - Echoes of the Past - Beach King Pecora
 
How the Postgres Query Optimizer Works
How the Postgres Query Optimizer WorksHow the Postgres Query Optimizer Works
How the Postgres Query Optimizer WorksEDB
 

Tendances (14)

The Owl House - Eclipse Lake - Ending
The Owl House - Eclipse Lake - EndingThe Owl House - Eclipse Lake - Ending
The Owl House - Eclipse Lake - Ending
 
Building a Directed Graph with MongoDB
Building a Directed Graph with MongoDBBuilding a Directed Graph with MongoDB
Building a Directed Graph with MongoDB
 
The Owl House - Eclipse Lake - Cold open
The Owl House - Eclipse Lake - Cold open The Owl House - Eclipse Lake - Cold open
The Owl House - Eclipse Lake - Cold open
 
db2dart and inspect
db2dart and inspectdb2dart and inspect
db2dart and inspect
 
CSS For Backend Developers
CSS For Backend DevelopersCSS For Backend Developers
CSS For Backend Developers
 
The Owl House - Hunting Palismen - Ending
The Owl House - Hunting Palismen - EndingThe Owl House - Hunting Palismen - Ending
The Owl House - Hunting Palismen - Ending
 
MariaDB Galera Cluster presentation
MariaDB Galera Cluster presentationMariaDB Galera Cluster presentation
MariaDB Galera Cluster presentation
 
Introduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizerIntroduction to Mongodb execution plan and optimizer
Introduction to Mongodb execution plan and optimizer
 
Tema 2 fracciones ejercicios
Tema 2 fracciones ejerciciosTema 2 fracciones ejercicios
Tema 2 fracciones ejercicios
 
The Owl House - Hunting Palismen - Palismen adoption day
The Owl House - Hunting Palismen - Palismen adoption dayThe Owl House - Hunting Palismen - Palismen adoption day
The Owl House - Hunting Palismen - Palismen adoption day
 
Indexes in postgres
Indexes in postgresIndexes in postgres
Indexes in postgres
 
Scala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowScala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To Know
 
The Owl House - Echoes of the Past - Beach
The Owl House - Echoes of the Past - Beach The Owl House - Echoes of the Past - Beach
The Owl House - Echoes of the Past - Beach
 
How the Postgres Query Optimizer Works
How the Postgres Query Optimizer WorksHow the Postgres Query Optimizer Works
How the Postgres Query Optimizer Works
 

Similaire à Cracking the Coding Interview - 7 steps - Udacity

Cracking the Coding interview (Abbreviated) - aug 2016
Cracking the Coding interview (Abbreviated) - aug 2016Cracking the Coding interview (Abbreviated) - aug 2016
Cracking the Coding interview (Abbreviated) - aug 2016Gayle McDowell
 
Cracking the Coding interview (College)
Cracking the Coding interview (College)Cracking the Coding interview (College)
Cracking the Coding interview (College)Gayle McDowell
 
Cracking the PM Interview
Cracking the PM InterviewCracking the PM Interview
Cracking the PM InterviewGayle McDowell
 
How to Hire Software Engineers: Best and Worst Practices
How to Hire Software Engineers: Best and Worst PracticesHow to Hire Software Engineers: Best and Worst Practices
How to Hire Software Engineers: Best and Worst PracticesGayle McDowell
 
Prepping Your Engineering Candidates to Reduce Your False Negatives
Prepping Your Engineering Candidates to Reduce Your False NegativesPrepping Your Engineering Candidates to Reduce Your False Negatives
Prepping Your Engineering Candidates to Reduce Your False NegativesGayle McDowell
 
Gayle Laakmann McDowell - Talent42 2015
Gayle Laakmann McDowell - Talent42 2015Gayle Laakmann McDowell - Talent42 2015
Gayle Laakmann McDowell - Talent42 2015Talent42
 
Cracking the PM Interview
Cracking the PM InterviewCracking the PM Interview
Cracking the PM InterviewGayle McDowell
 
Cracking the Product Manager Interview
Cracking the Product Manager InterviewCracking the Product Manager Interview
Cracking the Product Manager InterviewGayle McDowell
 
How to Interview Like Google (But Better) - SVCC
How to Interview Like Google (But Better) - SVCCHow to Interview Like Google (But Better) - SVCC
How to Interview Like Google (But Better) - SVCCGayle McDowell
 
Creating the (Im)perfect Developer Interview
Creating the (Im)perfect Developer InterviewCreating the (Im)perfect Developer Interview
Creating the (Im)perfect Developer InterviewGayle McDowell
 
Architecture of Tech Interviews
Architecture of Tech InterviewsArchitecture of Tech Interviews
Architecture of Tech InterviewsGayle McDowell
 

Similaire à Cracking the Coding Interview - 7 steps - Udacity (11)

Cracking the Coding interview (Abbreviated) - aug 2016
Cracking the Coding interview (Abbreviated) - aug 2016Cracking the Coding interview (Abbreviated) - aug 2016
Cracking the Coding interview (Abbreviated) - aug 2016
 
Cracking the Coding interview (College)
Cracking the Coding interview (College)Cracking the Coding interview (College)
Cracking the Coding interview (College)
 
Cracking the PM Interview
Cracking the PM InterviewCracking the PM Interview
Cracking the PM Interview
 
How to Hire Software Engineers: Best and Worst Practices
How to Hire Software Engineers: Best and Worst PracticesHow to Hire Software Engineers: Best and Worst Practices
How to Hire Software Engineers: Best and Worst Practices
 
Prepping Your Engineering Candidates to Reduce Your False Negatives
Prepping Your Engineering Candidates to Reduce Your False NegativesPrepping Your Engineering Candidates to Reduce Your False Negatives
Prepping Your Engineering Candidates to Reduce Your False Negatives
 
Gayle Laakmann McDowell - Talent42 2015
Gayle Laakmann McDowell - Talent42 2015Gayle Laakmann McDowell - Talent42 2015
Gayle Laakmann McDowell - Talent42 2015
 
Cracking the PM Interview
Cracking the PM InterviewCracking the PM Interview
Cracking the PM Interview
 
Cracking the Product Manager Interview
Cracking the Product Manager InterviewCracking the Product Manager Interview
Cracking the Product Manager Interview
 
How to Interview Like Google (But Better) - SVCC
How to Interview Like Google (But Better) - SVCCHow to Interview Like Google (But Better) - SVCC
How to Interview Like Google (But Better) - SVCC
 
Creating the (Im)perfect Developer Interview
Creating the (Im)perfect Developer InterviewCreating the (Im)perfect Developer Interview
Creating the (Im)perfect Developer Interview
 
Architecture of Tech Interviews
Architecture of Tech InterviewsArchitecture of Tech Interviews
Architecture of Tech Interviews
 

Plus de Gayle McDowell

Cracking the Product Manager Interview
Cracking the Product Manager InterviewCracking the Product Manager Interview
Cracking the Product Manager InterviewGayle McDowell
 
Hiring Great Product Managers
Hiring Great Product ManagersHiring Great Product Managers
Hiring Great Product ManagersGayle McDowell
 
Cracking the Coding Interview
Cracking the Coding InterviewCracking the Coding Interview
Cracking the Coding InterviewGayle McDowell
 
Reverse Engineering Engineering Interviewing: How to Be a Great Interviewer
Reverse Engineering Engineering Interviewing: How to Be a Great InterviewerReverse Engineering Engineering Interviewing: How to Be a Great Interviewer
Reverse Engineering Engineering Interviewing: How to Be a Great InterviewerGayle McDowell
 
Transitioning from Engineering to Product Management
Transitioning from Engineering to Product ManagementTransitioning from Engineering to Product Management
Transitioning from Engineering to Product ManagementGayle McDowell
 
Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...
Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...
Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...Gayle McDowell
 
Cracking the Coding & PM Interview (Jan 2014)
Cracking the Coding & PM Interview (Jan 2014)Cracking the Coding & PM Interview (Jan 2014)
Cracking the Coding & PM Interview (Jan 2014)Gayle McDowell
 

Plus de Gayle McDowell (7)

Cracking the Product Manager Interview
Cracking the Product Manager InterviewCracking the Product Manager Interview
Cracking the Product Manager Interview
 
Hiring Great Product Managers
Hiring Great Product ManagersHiring Great Product Managers
Hiring Great Product Managers
 
Cracking the Coding Interview
Cracking the Coding InterviewCracking the Coding Interview
Cracking the Coding Interview
 
Reverse Engineering Engineering Interviewing: How to Be a Great Interviewer
Reverse Engineering Engineering Interviewing: How to Be a Great InterviewerReverse Engineering Engineering Interviewing: How to Be a Great Interviewer
Reverse Engineering Engineering Interviewing: How to Be a Great Interviewer
 
Transitioning from Engineering to Product Management
Transitioning from Engineering to Product ManagementTransitioning from Engineering to Product Management
Transitioning from Engineering to Product Management
 
Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...
Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...
Interviewing Great Developers: Reverse Engineering Interview Coaching to Crea...
 
Cracking the Coding & PM Interview (Jan 2014)
Cracking the Coding & PM Interview (Jan 2014)Cracking the Coding & PM Interview (Jan 2014)
Cracking the Coding & PM Interview (Jan 2014)
 

Dernier

VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service BhiwandiVIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service BhiwandiSuhani Kapoor
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxGry Tina Tinde
 
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012sapnasaifi408
 
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsSonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsNiya Khan
 
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service CuttackVIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service CuttackSuhani Kapoor
 
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...shivangimorya083
 
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...shivangimorya083
 
VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...
VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...
VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...Suhani Kapoor
 
Résumé (2 pager - 12 ft standard syntax)
Résumé (2 pager -  12 ft standard syntax)Résumé (2 pager -  12 ft standard syntax)
Résumé (2 pager - 12 ft standard syntax)Soham Mondal
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Datingkojalkojal131
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girlsshivangimorya083
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipSoham Mondal
 
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boodykojalkojal131
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceSanjay Bokadia
 
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home MadeDubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Madekojalkojal131
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...Suhani Kapoor
 

Dernier (20)

VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service BhiwandiVIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
VIP Call Girl Bhiwandi Aashi 8250192130 Independent Escort Service Bhiwandi
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptx
 
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
 
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsSonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
 
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service CuttackVIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
VIP Call Girl Cuttack Aashi 8250192130 Independent Escort Service Cuttack
 
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...Vip  Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
Vip Modals Call Girls (Delhi) Rohini 9711199171✔️ Full night Service for one...
 
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCeCall Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
Call Girls In Prashant Vihar꧁❤ 🔝 9953056974🔝❤꧂ Escort ServiCe
 
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
 
VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...
VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...
VIP Russian Call Girls Amravati Chhaya 8250192130 Independent Escort Service ...
 
Résumé (2 pager - 12 ft standard syntax)
Résumé (2 pager -  12 ft standard syntax)Résumé (2 pager -  12 ft standard syntax)
Résumé (2 pager - 12 ft standard syntax)
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management Internship
 
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector Experience
 
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home MadeDubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
 

Cracking the Coding Interview - 7 steps - Udacity

  • 1. GayleL.McDowell | Founder/ CEO gayle in/gaylemcdgayle Cracking the Coding Interview CareerCup
  • 2. gayle in/gaylemcdgayleGayle Laakmann McDowell 2 Hi! I’m Gayle LaakmannMcDowell Author Interview Coach Interview Consulting <dev> </dev> (CS) (MBA)
  • 3. What We Look For Things that make you think 01
  • 4. Gayle Laakmann McDowell 4gayle in/gaylemcdgayle Why? Analytical skills How you think Make tradeoffs Pushthrough hard problems Communication Strong CS fundamentals
  • 5. gayle in/gaylemcdgayle 5 z Gayle Laakmann McDowell What is NOT expected To know the answers To solve immediately To code perfectly (It’snice.Itjustdoesn’t happen*.) *Okayfine.Ithappenedonce,in2000+hiringpackets.
  • 6. gayle in/gaylemcdgayle 6 z Gayle Laakmann McDowell What IS expected Be excitedabout hard problems Drive!  Keep trying when stuck  More than just “correct” Pay attention to me! Write real code Showmehowyouthink!
  • 8. gayle in/gaylemcdgayleGayle Laakmann McDowell 8 Essential Knowledge Data Structures Algorithms Concepts ArrayLists Merge Sort BigO Time Hash Tables QuickSort BigO Space Trees(+Tries) & Graphs Breadth-FirstSearch Recursion LinkedLists Depth-FirstSearch Memoization/ Dynamic Programming Stacks/ Queues BinarySearch Heaps
  • 9. gayle in/gaylemcdgayleGayle Laakmann McDowell 9 Preparation MASTER Big O ImplementDS/Algorithms Practicewith interview questions Code on paper/whiteboard Mock interviews PUSHYOURSELF!
  • 10. 7 Steps Things that make you think 03
  • 11. gayle in/gaylemcdgayle 11 z Gayle Laakmann McDowell How To Approach CrackingTheCodingInterview.com“Resources”
  • 12. gayle in/gaylemcdgayle 12Gayle Laakmann McDowell step Listen (for clues)
  • 13. gayle in/gaylemcdgayle 13Gayle Laakmann McDowell step Draw an Example INTERSECTION SIZE: Find # elementsin common between two sorted, distinct arrays:
  • 14. gayle in/gaylemcdgayleGayle Laakmann McDowell 14 Ex:Intersection ofTwo Sorted Arrays Most people draw somethinglike this: [1, 12, 15, 19] [2, 12, 13, 20]  Toosmall  Toospecial-case-y • same size, one commonelement, same index
  • 15. gayle in/gaylemcdgayleGayle Laakmann McDowell 15 Ex:Intersection ofTwo Sorted Arrays Better: [1, 12, 15, 19, 20, 21] [2, 15, 17, 19, 21, 25, 27]  Big  No specialcases
  • 16. gayle in/gaylemcdgayle 16Gayle Laakmann McDowell step Draw an Example Big Enough General Purpose +
  • 17. gayle in/gaylemcdgayle 17Gayle Laakmann McDowell step Brute Force / Naive Stupid&terribleisokay!
  • 18. gayle in/gaylemcdgayle 18Gayle Laakmann McDowell step Optimize Walk through brute force Look for optimizations
  • 19. Gayle Laakmann McDowell 19gayle in/gaylemcdgayle Techniquesto Develop Algorithms BUD Space andTime Do It Yourself
  • 20. Gayle Laakmann McDowell 20gayle in/gaylemcdgayle (A) Look for BUD Bottlenecks Unnecessary work Duplicated work
  • 21. Gayle Laakmann McDowell 21gayle in/gaylemcdgayle What’s the bottleneck?  Ex: countingthe intersection [1, 12, 15, 19, 20, 21] [2, 15, 17, 19, 21, 25, 27]  Brute Force: O(A * B)   Bottleneck:O(B) tosearch  Binary Search Algorithm: O(A log B)   Bottleneck:O(logB)tosearch  Sorted Merge: O(A + B) B
  • 22. Gayle Laakmann McDowell 22gayle in/gaylemcdgayle What’s unnecessary?  Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000  Unnecessary: looking for d U
  • 23. Gayle Laakmann McDowell 23gayle in/gaylemcdgayle What’s unnecessary?  Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000  Unnecessary: looking for d U
  • 24. Gayle Laakmann McDowell 24gayle in/gaylemcdgayle What’s duplicated?  Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000  Duplicated: c, d pairs D
  • 25. Gayle Laakmann McDowell 25gayle in/gaylemcdgayle What’s duplicated?  Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000  Duplicated: c, d pairs D c d c3 + d3 … … … 4 31 29855 4 32 32832 4 33 36001 … … … 5 59 205504 5 60 216125 5 61 227106 … … …
  • 26. Gayle Laakmann McDowell 26gayle in/gaylemcdgayle What’s duplicated?  Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000  Duplicated: c, d pairs D c3 + d3 (c, d) … … 29855 (4, 31) 32832 (4, 32),(18, 30) 36001 (4, 33) … … 205504 (5, 59) 216125 (5, 60),(45, 50) 227106 (5, 61) … …
  • 27. Gayle Laakmann McDowell 27gayle in/gaylemcdgayle What’s duplicated?  Ex: a3 + b3 = c3 + d3 (1 <=a,b, c, d<= 1000 D
  • 28. Gayle Laakmann McDowell 28gayle in/gaylemcdgayle (B)Space/TimeTradeoffs Hashtables & other datastructures Precomputing
  • 29. Gayle Laakmann McDowell 29gayle in/gaylemcdgayle (C)Do it yourself Findpermutationsof swithinb
  • 30. gayle in/gaylemcdgayleGayle Laakmann McDowell 30 find abbcd in b a b c d b a e f d b b a c b d d f a e 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  • 31. Gayle Laakmann McDowell 31gayle in/gaylemcdgayle (C)Do it yourself Findpermutationsof swithinb  s = abbcd  b = Findthem!  … now how didyou actuallydoit? b a b c d b a e f d b b a c b d d f a e
  • 32. Gayle Laakmann McDowell 32gayle in/gaylemcdgayle Techniquesto Develop Algorithms BUD Space and Time Do It Yourself
  • 33. gayle in/gaylemcdgayle 33Gayle Laakmann McDowell step Walk Through Know the variables andwhen they change
  • 34. gayle in/gaylemcdgayle 34Gayle Laakmann McDowell step Write Beautiful Code
  • 35. Gayle Laakmann McDowell 35gayle in/gaylemcdgayle How toWrite WhiteboardCode Top-leftcorner Short Hand Helps Good style Modularize (upfront!)
  • 36. Gayle Laakmann McDowell 36gayle in/gaylemcdgayle ShortHandHelps Good: Good Enough &Easier:
  • 37. gayle in/gaylemcdgayleGayle Laakmann McDowell 37 Good Style Appropriate & ConsistentSpacing Good Variable Names BAD
  • 38. gayle in/gaylemcdgayleGayle Laakmann McDowell 38 Modularization
  • 39. gayle in/gaylemcdgayle 39Gayle Laakmann McDowell step Testing FIRST Analyze  What’s it doing? Why?  Anything that looks weird?  Errorhot spots THEN use test cases  Small test cases  Edge cases  Biggertest cases BUT…  Test code, notalgorithm  Think as you test  Think before you fix
  • 40. gayle in/gaylemcdgayle 40 z Gayle Laakmann McDowell How To Approach CrackingTheCodingInterview.com“Resources”
  • 41. If you forget everything else Please remember this 04
  • 42. gayle in/gaylemcdgayleGayle Laakmann McDowell 42 Please please please please Create example  Big (tinyisuseless)  Generic(nota specialcase) Walkthrough it  Figureouttheoutputforthatoneinput  (Don’tworryaboutalgorithms/ implementation) DO NOT CODE UNTIL YOU’RE READY  100%surethatyouknowwhatyou’redoing  100%surethatyourinterviewwantsyoutocode
  • 43. gayle in/gaylemcdgayleGayle Laakmann McDowell 43 Other Resources Gayle.com CareerCup.com CrackingThe CodingInterview.com Or, follow me online • facebook.com/gayle • twitter.com/gayle • gayle.com • gayle@gayle.com • quora.com