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