You are on page 1of 6
P “CRACKING CODING INTERVIEW 7 189 PROGRAMMING QUESTIONS & SOLUTIONS Introduction Introduction. .... . w. vi. The Interview Process . . Wig te eet eee fae ee se ee titan nee Peigne chant 4 How Questions are Selected . F 6 It's All Relative . 7 Frequently Asked Questions i ee ee ee Bebbad the Soenesiss i175 20 0040 41 sie siecle finislsye et eerie Rite ees The Microsoft interview . 9 ‘The Amazon Interview 10 The Google Interview o.oo eevee eee eee eee eee e eee ee : 10 ‘The Apple Interview . . Pedectecss u ‘The Facebook Interview . . ee : 12 ‘The Palantir Interview . 7 1B Special Situations... . Experienced Candidates ee eee eee eee eens Testers and SDETs . 15 Product (and Program) Management ........... 0... : 16 DevLead and Managers... 0.6.00. 6 cece eee eens cet een Startups Acquisitions and Acquihires . For Interviewers Before the Interview... . . Getting the Right Experience 26 Writing a GreatResume ......... Se orecLr 27 Preparation Map. - 30 Behavioral Questions Interview Preparation Grid ..... 2... eee see le) eet . 32 Know Your Technical Projects. 0.6.2... e ee Ae 33 Responding to Behavioral Questions. ...... . eee ees So, tell me about yourself. 5 36 BigO....... An Analogy... 2... .0s cece eee Q 38 Time Complexity. 6.26.26... 0c eee 38 Space COMPIONY ccm jee echo arere eel eteise dl ‘ 40 Drop the Constants... . . eee . cee Drop the Non-Dominant Terms . . or 42 Cracking the Coding Interview, 6th Edition Introduction Multi-Part Algorithms: Add vs. Multiply .........« wu cece MD Amortized Time . . : ee ee Ps 43 Log NRuntimes .... 0.0.02 se sete rere eens wanaaren ss ot ¢ 44 Recursive Runtimes. - 4 Examples and Exercises . .. 45 Vil. Technical Questions ......+. ++ 60 HowtoPrepate . i: ansrismelcsewnesersiereotecsceas 5 ween: 60 What You Need ToKNOW. 0.0202 e eves eens e eee ee eens = - 60 Walking Through a Problem 2 Optimize & Solve Technique #1: Look for BUD... 6. eee 0e eee ee neers cee Optimize & Solve Technique #2: DIY (Do It Yourself)... . cee 69 Optimize & Solve Technique #3: Simplify and Generalize... 2.20.0. 00sec secre ee eee TV Optimize & Solve Technique #4: Base Case and Build. ... 6... 0s. e eee Seecec ce iee Tl Optimize & Solve Technique #5: Data Structure Brainstorm... .. n Best Conceivable Runtime (BCR). . 2 Handling Incorrect Answers... 2.2.0.0 eee faeeeenc 78 When You've Heard a Question Before... 6... esses chewnn ea) seunnesannasan (4 ‘The*Perfect” Language for Interviews... 6.0.6... re. 76 What Good Coding Looks Like... 622s eee e Sejelctnel an tf n gi 7 Don't Give Up! Bc 81 VII, The Offer and Beyond ...... ne 82 Handling Offers and Rejection... .. Bee eee ‘ ec smanecanar 82 Evaluating the Offer... 83 Negotiation 84 ‘On the Job - 85 1X. Interview Questions . . 87 Data Structures ........ +88 Chapter 1 | Arrays and Strings eye eee cee 88 Hash TOBIES. john sma tas Vas ee tect eer es 88 ArrayList & Resizable Arrays... oe. oeceeee eee eee eeee eee eee eeeeneeenes 89 StingBON Ser co - soe oeericcne teen ewe oe atena eke amHrn es «yeqaee tees 89 Chapter 2 | Linked Lists. . . . 2 Creating a Linked List... 00... +0 seee eee eeteeeeeeee ees 2 Deleting a Node froma Singly Linked List... 02+. 02+ 8 The “Runner* Technique ...... eaesugenese os . 93 Recursive Problems. . B CrackingTheCodinglnterview.com| 6th Edition | Vil Introduction Chapter 3 | Stacks and Queues. . 96 Implementing a Stack. ..... 60.060. 00005 sie cee 96 Implementing a Queue... 6. oe eve eee eect e teeter eee eee ee ”7 Chapter 4 | Trees and Graphs... -100 Types of Trees aero eae wees 4 bau pe 100 Binary Tree Traversal... ... pcope up epeseouesn vee 108 Binary Heaps (Min-Heaps and Max-Heaps) ..-- 02... 00ceeeeveeees . ++ 108 Tres (Prefix Trees)... 105 GIONS. oon sons ce . vee coe 105 Graph Search 107 Concepts and Algorithms...... 26. ....seesees Seer nella Chapter 5 | Bit Manipulation 2 Bit Manipulation By Hand -m2 BitFactsand Tricks... 0. vee eee e eee eee ee cence eee eee ee are -12 Two's Complement and Negative Numbers. ..... 602 .0eecveee ee veces 13 Arithmetic vs. Logical Right Shift... 00.00. v ee cee eevee eee eo 13 Common Bit Tasks: Getting and Setting . 14 Chapter 6 | Math and Logic Puzzles. . SuounGonpecoousoops cul Prime Numbers «2... <7 Probability... o eevee eee cence eee ee eet eeee ees -119 ISUOIU TOURING = 7 sen te os ges sey 40s pans Vanesa Hee 2121 Develop Rules and Patterns . . 21 Worst Case Shifting 122 Algorithm Approaches hess ee 1 122 Chapter 7 | Object-Oriented Design = 125 How to Approach = 125 Design Patterns... . = 126 Chapter 8 | Recursion and Dynamic Programming ee 130 HOMIOAOPIOOD, 06. sees en erence ennt en kea meant eameenr em ne . 130 Recursive vs. Iterative Solutions... . a taste 131 Dynamic Programming & Memoization. - coe a 131 Chapter 9 | System Design and Scalability. 137 Handling the Questions 137 Design: Step-By-Step a . - vo 138 Algorithms that Scale: Step-By-Step - 139 Key Concepts . - 140 vit | Cracking the Coding Interview, 6th Edition Considerations . There is no “perfect” system. Example Problem. Chapter 10 | Sorting and Searching. . ‘Common Sorting Algorithms . Searching Algorithms . Chapter 11|Testing. 0... +. What the Interviewer Is Looking For . . . Testing a Real World Object Testing a Piece of Software Testing a Function Troubleshooting Questions . Knowledge Based... . . ace Chapter 12|Cand C++ . . (Glasses and inheritance. Constructors and Destructors. . Virtual Functions... . Virtual Destructor Default Values... .- Operator Overloading. . . Pointers and References . . bee Templates Chapter 13 | Java. How to Approach. Overloading vs. Overriding Collection Framework. Chapter 14 | Databases... . ‘SQL Syntax and Variations. Denormalized vs. Normalized Databases. SQL Statements: ‘Small Database Design. Large Database Design. Chapter 15 | Threads and Locks Threads in Java ‘Synchronization and Locks Deadlocks and Deadlock Prevention . Introduction 142 143 143 146 CrackingTheCodinginterview.com |6th Edition | 1X Introduction xl, xt. xin, xiv. Additional Review Problems... . Chapter 16 | Moderate Chapter 17 | Hard Solutions . Data Structures ..... 2. Concepts and Algorithms... Knowledge Based . . ‘Additional Review Problems . . Advanced Topics. Useful Math. . Topological Sort. . Dijkstra’s Algorithm . Hash Table Collision Resol Rabin-Karp Substring Search . AVLTIEES 00 i Red-BlackTrees .......... Fae MapReduce.......... Additional Studying Code Library < is cseseicevesess HashMaplist. . TreeNode (Binary Search Tree)... . LinkedListNode (Linked List) Trie&TrieNode ...... ' WHINRS! fs ecalerersate erererete ts ristveta eta siete Hints for Data Structures... . . Hints for Concepts and Algorithms Hints for Knowledge-Based Questions Hints for Additional Review Problems About the Author . . . Join us at www.CrackingTheCodingInterview.com to download the complete solutions, contribute or view solutions in other programming languages, discuss problems from this book with other readers, ask questions, reportissues, view this book's errata, and seek additional advice. x racking the Coding interview, 6th Edition

You might also like