# Cracking the coding interview ## The Interview Process Based on: - Analytical skills - Coding skills - Technical knowledge / CS fundamentals - Culture fit / Communication skills Why: - False negatives are acceptable (better miss a good candidate than selecting a bad candidate). - Problem solving skills are valuable (if you can solve, you are probably smart). - Basic data structure and algorithm knowledge is useful. Problem solving questions almost always involve them. - Whiteboards let's you focus on the main aspect. - It is not for everyone, but is a reasonable judgement. Question selection: - Every interviewer selects their own question - Often don't differ much from asked recently or three years ago by whichever company, pretty much the same. - Performance of candidate is relative to another candidate. FAQ: - Check in within 3 - 5 days with your recruiter after interview (if you haven't heard from them yet). - Late response does not say anything about your status of getting hired (or not). - Almost always you can reapply, with period of 6 months to 1 year. ## Behind the Scenes Recruiter: - As recruiter beforehand the position of the interviewer (Engineer usually performs technical interview). - Often the interviewer does not decide if you get hired. Screening often involves: - coding, algorithm questions - behavioral questions - design/architecture - often 3 to 6 in-person interviews (with lunch: good time to discuss culture). The Microsoft Interview: - Your recruiter can help you. - Often 4 to 5 meetings, with different teams. - Speaking with the hiring manager is a good sign. - Recruiter not responsive? probably busy. - Question(s): Why do you want to work for Microsoft? - Show that you are passionate; - "I've been using Microsoft software as long as I can remember, and I'm really impressed at how Microsoft manages to create a product that is universally excellent. For example, I've been using Visual Studio recently to learn game programming, and its APls are excellent." The Amazon Interview: - Often 1 to 2 to more phone meetings, with a specific team. - Write code via shared editor. - Broad set of questions to see what you are familiar with. - Fly to Seattle (or whichever you are applying for) for 4 to 5 in-person interviews. - Code on a whiteboard. - Doing bad in an interview is relative; if you are wrong does not mean you won't pass. - Impress hiring manager & bar raiser (from different team). - Questions: Scalability & OO-design. - Prepare for scalability questions. The Google Interview: - Often 1 phone meeting, technical questions, sometimes with shared document. Often not strong factor. - Same questions on phone as on-site interviews. - Interview with 4 to 6 people, one is lunch interviewer (often great time to ask honest questions). - Each interviewer can conduct interview however (s)he likes. - An enthusiatic interviewer is important for getting hired. - Can take several weeks (so many stages and committees). - Questions: Analytical Ability, Coding, Experience and Communication. - Prepare for system design and scalability. The Apple Interview: - Often 1 phone screen interview to get a basic sense of skills. - 6 to 8 interviews with members of team and key people. - Mix of one-on-one, two-on-one. - Be ready to code on whiteboard. Communicate your thoughts clearly. - Lunch interview appears casual but is still interview. - Interview with director and VP is good signal. - Questions: read up on the product. - What could be improved? - Show passion for Apple products. The Facebook Interview: - Often 1 to 2 phone screen interviews. It will be technical and involve coding, usually with online document editor. - Homework assignment which is a mix of coding and algorithms. - Pay attention to coding style. - On-site primarily interview with other software engineers. Hiring managers often involved. - Roles: - Behavioral ("Jedi"): Successful in Facebook's environment? Culture and values, excited/passionate, tackle challenges, interest in Facebook? - Coding and Algorithms ("Ninja"): Standard questions. - Design/Architecture ("Pirate"): Discuss trade-offs and solutions. - Often two "Ninja" and one "Jedi"; Experienced also get "Pirate". - Questions: Entrepreneurial spirit; Show that you love to build stuff fast. - Show that you can build elegant and scalable solution. - Have a 6 week bootcamp; senior dev mentorship, learn best practices, get greater flexibility in choosing a project. The Palantir Interview: - Interviews for a specific team. - Often 2 phone interviews; 30 to 45 minutes; primarily technical. Heavy focus on algorithms. - Get send HackerRank coding assessment. - On-site interview with up to five people. - Show passion for the company. Often harder questions that Google. - Questions: prior experience, domain knowledge, DS and Algo, Design. ## Special Situations Experienced candidates: - Algorithms will always be important - professionally: more focus on system design and architecture Testers and SDETs: - How would you test it - Know your coding - Antying can be tested - Behavioral is also important Career advice: - Coding skills are key - Don't think you can switch from easy to hard job Product (and Program) Management - Handle ambiguity - Ask a lot of questions - Focus on customer (Attitude, Technical Skills) - Multi-Level communication (All levels in company hierarchy) - Passion - Teamwork / Leadership Dev Lead and Managers - Be strong with coding and algorithms - Teamwork / Leadership - Prioritization - Communication - "Getting Things Done" (Motivate people and finish stuff) Startups - Can be very different from one to the next - Often get in through personal reference - Often not able to sponsor visa - You need to be entrepreneurial ("Hit the ground running") - Personality, Skill set and Experience fit Acquisitions and Acquihires: - Not always easy way to "get in" For Interviewers - Don't ask questions in this book - Ask Medium and Hard Problems - Look for questions with multiple hurdles, insights or optimizations - Hard questions not hard knowledge - Avoid "scary" questions - Probe deeper for behavioral questions - Coach candidates - Give them silence - Modes of questioning: - Sanity Check: Minimum degree of competence - Quality Check: Rigorous questions designed to make the candidate think - Specialist Questions: Specific topic - Proxy Knowledge: Ask question related to their experience ## Before the Interview Getting the Right Experience: - Take the Big Project Classes - Get an Internship - Start Something - Shift Work Responibilities More Towards Coding - Use Your Nights and Weekends Write a Great Resume: - Length of 1.5 to 2 pages - Limit to most impressive items Employment History: - Write Strong Bullets (SMART principle) Projects: - Only show most important 2 to 4 projects Programming Languages and Software: - Almost always leave out Microsoft Office - No IDE - Best first with your expert level Advice for Non-Native English Speakers and Internationals - Proofread for typo's - Leave out age, marital status and nationality Beware of (Potential) Stigma - Enterprise language (.NET etc.) - Don't mention specific "Java"-versions (or other programming language specific versions etc.) - Don't mention too much (irrelevant) technologies - Know more than One or Two "Similar" languages (Like C# & .NET or Ruby & Python) Preparation Map - See this how to prepare ## Behavioral Questions Common questions about projects you've done: - Challenges - Mistakes/Failures - Enjoyed - Leadership - Conflicts - What You'd Do Differently Should elaborate on projects where I've had a central role. What are your weaknesses? - Perfectionist; prematurely optimize. Can be detrimental to speed. - ... Questions for interviewer: - What brought you here? What was most challenging for you? - What is ratio of testers to developers? What is interaction like? How does project planning happen on the team? - I noticed that you use technology X. How do you handle problem Y? - What opportunities are there in this company to learn X? - I'm not familiar with technology X, but sounds cool. Could you tell me a little bit more about that? Asnwering: - Limit details; "I can co into more details if you like" - Focus on your own impact - give nugget (what will I tell) first and then S.A.R. response So, tell me about yourself... - Current role (I'm an .... at .. where I was responsible for ...) - College - Post college - Current role details - Outside work - Wrap up ## Big O Examples of runtime: - O(1) = Constant time - O(n) = Linear time Runtime bound types: - O (big O): Upper bound on time - Ω (big omega): Lower bound on time - Θ (big theta): Tight bound on time Interview: provide tightest runtime description. Best case (best time), Worst case (worst time) and expected case (average time) describe big O (or big theta) time for particular inputs or scenarios. Space and Time complexity: - array of n will take O(n) space and time complexity. - Drop constants (O(2N) becomes O(N)) - Drop non dominant terms (O(N^2 + N) becomes O(N^2)) - Don't drop when terms with different variables (O(B^2 + A) stays O(B^2 + A)) - Addition or multiplication: - Two for loops consequtively = O(A + B) - Two for loops nested = O(A * B)