← Back to resources

March 4, 2026 • Parth Narkar

Coding Interview Patterns That Keep Showing Up

Master the most common coding interview patterns including Two Pointers, Sliding Window, Hash Maps, and essential communication strategies.

Two Pointers

When to use: Sorted arrays, strings, finding pairs

How it works: Start pointers at opposite ends, move based on logic

Example use: Find two numbers that sum to target

Time complexity: Usually O(n)

Sliding Window

When to use: Subarrays, substrings, consecutive elements

How it works: Maintain a window and slide it through array

Example use: Longest substring without repeating characters

Pattern: Expand window, then shrink when condition breaks

Hash Maps (Dictionaries)

When to use: Need fast lookups, counting frequencies

How it works: Store elements as you iterate for O(1) access

Example use: Two sum problem, finding duplicates

Trade-off: Uses extra O(n) space for speed

Communication Tips

  • Think out loud before writing code
  • Start with a brute force approach
  • Use simple test cases (empty, one element, typical)
  • Ask clarifying questions about inputs

Practice Resources

  • LeetCode Easy problems first
  • NeetCode roadmap (patterns organized)
  • Mock interviews with friends
  • Record yourself explaining solutions