Coding Test Pattern

Coding Test Pattern

1. Backtracking

  • Example Problems

2. Dynamic Programming

  • Example Problems

3. Binary Tree Traversal

  • Example Problems

4. DFS, BFS

  • Example Problems

5. Top K Elements

  • Example Problems

6. Prefix Sum

  • Example Problems

7. Sliding Window

  • Useful pattern for finding consecutive subarrays
  • Can reduce time complexity from O(n * k) to O(n) compared to brute force (k is the size of the subarray)
  • Generally uses start_index and end_index to represent the start and end of the window
  • Example Problems

8. Two Pointers

  • Pattern where two pointers move toward each other or in opposite directions while searching
  • Can reduce time complexity from O(n^2) to O(n) compared to brute force
  • Example Problems

9. Fast and Slow Pointers

  • Example Problems

10. Modified Binary Search

  • Example Problems

11. Monotonic Stack

  • Example Problems

12. Linked List In-Place Reversal

  • Example Problems

13. Overlapping Intervals

  • Example Problems