The Process

  1. Set aside 30 - 45 mins for each question → Only look at solutions if you can’t solve it in that time
  2. Put away the code → bring out a pen and paper
  3. Identify what concept the problem is really asking about
    1. Eg. If it’s a Data Structures question, which data structure is most appropriate here?
    2. If it’s a sorting question,
    3. If it’s a dynamic programming question, which sub-problems am I solving again and again?
  4. Start first by designing an algorithm with pen and paper.
    1. If you don’t have test cases, create a reasonable number of test cases that should cover the problem scope
    2. List your assumptions
    3. If you’re stuck, don’t try to create the most optimal solution right away. A brute force solution is better than no solution → you can always optimize afterward
    4. Practice thinking out loud! This is super important - Interviewers want to see how you think, and vocalizing your thought process makes this crystal clear.
  5. Implement your algorithm in your language of choice and test it
  6. Think about space-time complexity/ areas for improvement