During Interview

Given a problem

  1. To pace myself, may I know how many questions are planned for this interview?
  2. Communicate only when needed
    1. Explain only the critical parts
  3. Clarifying questions
    1. Negative numbers?
    2. Duplicates?
    3. Sorted numbers?
    4. Empty input?
    5. Will this function be called a lot?
    6. Will we have a lot of data?
    7. Graph has cycle?
    8. Can you modify the input array?
  4. Visualize the problem
    1. Array for each state change
    2. Tree / Graph
  5. Example input and outputs
    1. Write out edge cases examples
    2. Come up with a longer example
    3. Come up with a totally different short example
  6. What are the edge cases?
  7. Apply common Data Structures
    1. Hash map
    2. Heap
    3. Stack and Queue
    4. Tree
    5. Graphs / Tree / Trie
    6. Linked List
  8. Apply common Algorithms
    1. Two Pointers / Fast & Slow Pointers
    2. Sliding Window
    3. DFS / BFS
    4. Subset / Combination / Permutation
    5. Top K
  9. What is a brute force solution? And, its complexity?
  10. Explain how you would and then code the brute force solution if needed.
    1. Write out the high level plan
    2. Break the question down into smaller independent parts
  11. Test example line by line
  12. Test edge case example line by line
  13. Is there a pattern you can use to optimize the solution?
  14. How would you implement the optimized solution?
  15. Why is it better than the brute force solution?
  16. What is the Best Theoretical Time Complexity?