Cracking MAANG: Coding interview prep guide
Cracking MAANG: Coding interview prep guide

Cracking MAANG: Coding interview prep guide

TL;DR: How to solve algorithmic problem?

Read, Repeat, Understand inputs & output with examples, Constraints (edge cases), Ideas (whys, tradeoffs, solve simpler version, imagine helper functions - go from high level to low level), Complexities, Code, Test code. Interact more.

How will you be evaluated during a coding interview?

  1. Communication - Asking clarifying questions, communication of approach and tradeoffs clearly such that the interviewer has no trouble following.
  2. Problem solving - Understanding the problem and approaching it systemically, logically and accurately, discussing multiple potential approaches and tradeoffs. Ability to accurately determine time and space complexity and optimize them.
  3. Technical competency - Translating discussed solutions to working code with no significant struggle. Clean, correct implementation with strong knowledge of language constructs.
  4. Testing - Ability to test code against normal and corner cases, self-correcting issues in code.

Check UntitledUntitled

My step-by-step plan for algo problem solving

Track time, overall 45 minutes (5 minutes to understand problem, 10 minutes to propose solution, 15 minutes for code, 10 minutes for follow-up question, 5 minutes for open talk)

  1. Read the problem, repeat it, understand it. Don’t immediately jump into coding!
  2. Understand inputs and outputs. Draw some examples. Clarify requirements, ask clarifying questions, and understand constraints (edge cases). Example questions: Is it ASCII or Unicode? What is the max value? Is there a difference between capital letters and small letters? Check my questions lists here.
  3. Think about the solution in your mind. Divide problems into sub-problems. Come up with different ideas (ask whys, think about trade-offs, solve simpler versions, imagine helper functions - go from high level to low level).
  4. Evaluate the complexity and trade-offs.
  5. Think of a better alternative solution.
  6. Debug your code on paper and test with new corner case inputs.
  7. Write code. Write clean code.
  8. Write tests. Positive, negative, with edge-cases.

More to read:

During the Interview

  1. Make a good self introduction at the start of the interview, 1 — 2 min max. Speak with a smile and you will naturally sound more engaging.
  2. Ask how many problems we will solve? It will help you with time management during interview.
  3. Track time! 45 minutes (5 minutes to understand problem, 10 minutes to propose solution, 15 minutes for code, 10 minutes for follow-up question, 5 minutes for open talk)
  4. Follow my step-by-step plan:
    • Paraphrase and repeat the question back at the interviewer to make sure you understand the problem right, and to solve the correct problem.
    • Clarify assumptions, ask questions (input, output, problem specific, data structure specific questions)
    • Run through a simple example, propose a solution, provide complexity analysis, only code if interviewers says OK.
    • and so on
  5. Do not jump into coding right away or before the interviewer gives you the green light to do so.
  6. Communication and collaboration, problem solving and critical thinking.
    1. These conversations are meant to be collaborative and show you what it would be like to work with us. Talk like you are talking to friend. I am a problem solver, I am a collaborative team member, take ownership of projects.
    2. Interview is about evaluating how you think and approach to solution, not about writing 100% working code. Communication/collaboration of thought process and problem solving ability.
    3. Tips: Explain and clarify, clarify questions. Keep thinking.
  7. During writing code:
    1. Explain what you are trying to achieve as you are coding
    2. Write actual compilable, working code where possible, not pseudocode
    3. Write clean code, use good variables names (don’t use a, b, c)
    4. Ask for permission to use trivial functions without having to implement them. E.g. reducefilterminmax should all be ok to use
    5. Write simple assert test and run simple example
    6. Explain trade-offs and how the code / approach can be improved if given more time
  8. Ask from interviewers if you are going right direction.
  9. Do not interrupt your interviewer when they are talking. Usually if they speak, they are trying to give you hints or steer you in the right direction.
  10. Do not use a lot of programming language built-in functions. If you use it, describe what the method does.
  11. If stuck: solve simpler version of problem. It is okay to have some code, then optimize it.
  12. For example, you need to get a sorted data structure for the problem. You can ask the interviewer if it is okay to create imaginary function.

  13. Make it feel like you're on a team. Think aloud.
    1. Should I handle this case?
    2. Is it ok I will make this assumption?
    3. Let's try doing it this way—not sure yet if it'll work.
    4. Then I'd usually check the code against some edge cases—should we do that next?
  14. Optimizations: Try different Data Structure: Array, HashMap/Set, Heap, Queue, Stack. LinkedList. Tree. Graph. Trie.
  15. In the end of the interview ask 2 questions about company, prepare them beforehand.

Questions: Corner Cases and Constraints

  1. Ask about edge cases (propose edge case). Explain and clarify, DS tradeoff, time and space complexity.
  2. Questions
    1. How am I receiving this data?
    2. How should I output the result?
    3. What if wrong input is provided?
    4. How long/big our input could be?

      Empty inputs, null values, 0 length, 1 element input, super long input.

  3. Is size, speed, using not build-in library a concern?
  4. How I would be testing? Tests: Zero, one, two, two to max-1, max, max+1
  5. Questions to ask
  6. OOP
    Number (int, float)
    Strings
    Array
    Sorting algorithm
    Stack/queue
    Linked list
    Tree
    Graph
    Loops
    Recursion

Tricks and Advice

1 Day Before Interview

Reverse Interview Questions

  1. What’s you favorite part of working at ___?
  2. What does it mean to be successful here, and how do you measure success?
  3. What would a typical day/week for someone in this role look like? Meetings, working, meetings?
  4. How the first few month look like at … when you join the team?
  5. What are the engineering challenges that the company/team is facing?
  6. How are requirements / expectations communicated? What is the performance review process like?
  7. How do you test your apps? How releases look like at …? Code review process? Test plan?
  8. What do you like least? What would you change if you could?
  9. How do you look at interviews, when tools such copilot or GPT come out?

More questions: https://github.com/yangshun/tech-interview-handbook/blob/main/apps/website/contents/final-questions.md

More resources

SuperMade with Super