Skip to content
Veltoryx Technologies
FreeLesson 0.2Beginner2 min readUpdated 30 October 2026

Which pattern? A map from clues to techniques

The words in a problem statement that hint at each pattern, so you can pick a starting point in the first minute.

Most interview problems give their pattern away in the wording. Read the question, look for these clues, and you'll usually know where to start.

01Clue → pattern

If the problem says…Try
"Have I seen this before?", duplicates, counts, "group by"Arrays and hashing
Sorted array, "pair that adds up to", palindrome, "in place"Two pointers
"Longest / shortest subarray or substring" with a conditionSliding window
Sorted data, "find the smallest X such that…", O(log n) askedBinary search
Nodes with next, "reverse", "cycle", "middle"Linked lists
Matching brackets, "next greater", undo, most recent firstStacks and queues
The problem is a smaller copy of itselfRecursion
"All combinations / permutations / subsets", "every way to"Backtracking
Root, children, depth, "level by level"Trees
Grid of cells, islands, "shortest path in steps"BFS, DFS and grids
Dependencies, "order of tasks", connections between many thingsGraphs
"How many ways", "minimum cost", choices that overlapDynamic programming
Prefixes, autocomplete, "words starting with"Trie

02How to use this map

  1. Underline the clue words in the question.
  2. Pick the pattern from the table and write its skeleton pseudocode.
  3. Fit the details: what goes in the map, what the two pointers mean, when the window shrinks.

03Input size tells you the speed you need

n up toUsually fine
20O(2ⁿ) backtracking
1,000O(n²)
100,000O(n log n) or O(n)
10⁹O(log n) or O(1)