Pattern signals

Which pattern does this problem want?

Interview problems tell you what they want. Not in the title — in the phrasing. “Contiguous” is a sliding window. “Fewest steps” is BFS. “Minimum X such that it's feasible” is binary search on the answer. These are the 34 signals the course teaches you to read for, with the reasoning link each time — because the link is what transfers to the problem you haven't seen.

The method behind this table is the first module of the course, and it's free: Reading a Problem: Choosing the Right Tool →

Module 02

Complexity, Big-O & the Cost Model

You see

input size hint: n up to 1e5–1e6

  • constraints
  • complexity
Reach for

Target O(n) or O(n log n) — a nested loop won't pass

Constraints tell you the intended complexity. 1e5 ⇒ n log n; 1e9 ⇒ O(log n) or O(1).

Module 04

Arrays & Strings

You see

“in place”, “O(1) extra space”, “modify the array itself”

  • array
  • in-place
  • space
Reach for

Write index / in-place array mechanics

A slow write index lags the scan and only advances on elements you keep — dedup, compaction and partitioning are all this one idiom.

You see

“rotate the array by k”

  • array
  • in-place
  • rotation
Reach for

Three reversals

Reverse the whole array, then the first k, then the rest — O(n) time and no second array.

You see

lowercase letters only / a fixed small alphabet

  • string
  • counting
Reach for

Fixed-size frequency array, not a map

A [26]int is stack-allocated, needs no hashing, and is comparable with == so two tables compare in one expression.

Module 05

Hashing: Maps & Sets

You see

“anagram”, “seen before”, “count of each”, “group by”

  • string
  • count
  • dedupe
Reach for

Hash map / frequency map

Any time identity or multiplicity matters and order doesn't, a map turns O(n²) scans into O(n).

You see

“has this been visited?”, need a set of things

  • set
  • membership
Reach for

Hash set (map[T]struct{})

O(1) membership. In Go there's no set type — use map[T]struct{}.

Module 06

Two Pointers

You see

sorted array + find a pair / triplet / condition

  • array
  • sorted
  • pair
Reach for

Two pointers

Sortedness lets one pointer move in from each end and discard half the space per step.

You see

“in-place”, “remove duplicates”, “move zeroes”, partition an array

  • array
  • in-place
Reach for

Two pointers (fast/slow write index)

A slow write pointer + fast read pointer compacts the array with O(1) extra space.

Module 07

Sliding Window

You see

“contiguous subarray” / “substring” + best or count

  • array
  • string
  • optimization
Reach for

Sliding window

Contiguous + an optimum means you can grow/shrink a window instead of re-scanning every range.

Module 08

Prefix Sums & Difference Arrays

You see

“subarray sum equals k” (not necessarily positive)

  • array
  • hashmap
  • count
Reach for

Prefix sum + hash map

Window breaks with negatives; prefixSum[j]-prefixSum[i]=k, so store seen prefix sums in a map.

You see

“range sum / range update”, many queries over an array

  • array
  • range-query
Reach for

Prefix sums / difference array (or a Fenwick tree)

Precompute once, answer each range query in O(1). Difference arrays do the same for range updates.

Module 10

Stacks & Monotonic Stacks

You see

“matching”, “nesting”, “most recent unmatched”, parentheses

  • parsing
  • nesting
Reach for

Stack

LIFO = 'the thing I care about is the most recent one I haven't resolved'.

You see

“next greater / smaller element”, “largest rectangle”, spans

  • array
  • next-greater
Reach for

Monotonic stack

Keep the stack sorted; pop while the new element dominates — each element pushed/popped once ⇒ O(n).

Module 12

Linked Lists

You see

“reverse a list”, “detect a cycle”, “nth from end”, “reorder list”

  • linked-list
  • pointers
Reach for

Linked list pointer manipulation (dummy head, fast/slow)

No indexing — everything is done by re-wiring `next` pointers with 2–3 cursors.

Module 13

Recursion & the Call Stack

You see

“all permutations”, “all subsets”, “generate every valid …”

  • recursion
  • enumeration
Reach for

Recursion / backtracking

Enumerating every combination is a decision per element, which is a recursive tree — choose, recurse, un-choose.

You see

the problem is defined in terms of itself — a tree, nested structure, or “solve the smaller case”

  • recursion
  • tree
  • divide-and-conquer
Reach for

Recursion (define the base case first)

When the shape is self-similar, the code is: base case, recurse on the parts, combine. Getting the base case wrong is the usual bug, not the recursion.

Module 14

Backtracking

You see

“generate all”, “all combinations/permutations/subsets”, N-Queens, Sudoku

  • enumerate
  • constraints
Reach for

Backtracking

Build a candidate incrementally, abandon (‘prune’) partial candidates that can't succeed.

Module 15

Trees & Traversals

You see

“tree”, “hierarchy”, “traverse”, “depth”, “ancestor”

  • tree
  • recursion
Reach for

Tree DFS/BFS recursion

Most tree problems are 'do something at each node + combine children's answers'.

Module 16

Binary Search Trees

You see

“BST”, “kth smallest in a tree”, “range of values in a tree”

  • tree
  • sorted
Reach for

In-order traversal / BST invariant

In-order visits a BST in sorted order — kth smallest, validation, closest value all follow.

Module 17

Heaps & Priority Queues

You see

“top k”, “k largest/smallest”, “k closest”, streaming median

  • k
  • streaming
  • selection
Reach for

Heap / priority queue

You only need the boundary element, not a full sort — a size-k heap is O(n log k).

You see

“merge k sorted lists/arrays”

  • k
  • merge
  • sorted
Reach for

Min-heap of heads

Always emit the global minimum among the k current fronts — that's exactly a min-heap.

Module 18

Tries (Prefix Trees)

You see

“prefix”, “autocomplete”, “words starting with”, dictionary of strings

  • string
  • prefix
  • dictionary
Reach for

Trie

Shared prefixes are stored once; lookup/insert is O(len), independent of dictionary size.

Module 19

Graphs: BFS, DFS, Toposort, Dijkstra, Union-Find

You see

“shortest path” in an unweighted grid/graph, “fewest steps”

  • graph
  • grid
  • shortest-path
Reach for

BFS

BFS explores in layers, so the first time you reach a node is via a shortest path.

You see

“all paths”, “connected components”, “flood fill”, cycle detection

  • graph
  • grid
  • components
Reach for

DFS (recursion or explicit stack)

DFS naturally follows one path to exhaustion — ideal for reachability and enumeration.

You see

“shortest path” with non-negative weights

  • graph
  • weighted
  • shortest-path
Reach for

Dijkstra (min-heap)

Greedily settle the closest unsettled node; a priority queue gives you that node in O(log n).

You see

“course schedule”, “build order”, “dependencies”, DAG ordering

  • graph
  • dag
  • ordering
Reach for

Topological sort (Kahn's BFS or DFS)

A valid order exists iff the dependency graph is acyclic; toposort produces one or detects a cycle.

You see

“are these two in the same group?”, connectivity queries, Kruskal

  • graph
  • connectivity
Reach for

Union-Find (disjoint set)

Near-O(1) union and find with path compression — beats re-running BFS per query.

Module 20

Greedy Algorithms

You see

“can you split / schedule / assign to hit a target”, feels greedy but tricky

  • scheduling
  • optimization
Reach for

Greedy — then prove it, or fall back to DP

Greedy is right only when a local best is never regretted (exchange argument). If it can be, use DP.

Module 21

Dynamic Programming

You see

“number of ways”, “min/max cost to…”, “can you reach…”, overlapping choices

  • count
  • optimization
  • sequence
Reach for

Dynamic programming

Optimal substructure + the same subproblem recurring ⇒ memoize or fill a table.

You see

“longest increasing subsequence”, edit distance, “X and Y strings/arrays”

  • string
  • sequence
  • 2d-dp
Reach for

DP over indices (often 2-D)

State = (position in A, position in B); transitions compare/skip one element.

Module 22

Intervals & Sweep Line

You see

“merge overlapping intervals”, “can attend all meetings”, calendar

  • intervals
  • sorting
  • sweep
Reach for

Sort by start, sweep

After sorting, overlap is a local check against the last kept interval / a running end time.

Module 23

Bit Manipulation

You see

n ≤ ~20, need exact answer, subsets of items

  • bitmask
  • small-n
  • subset
Reach for

Bitmask (subset enumeration / bitmask DP)

2^20 ≈ 1e6 states fit; an int is a fast, hashable set of up to 64 items.

You see

“without extra space”, “find the single number”, XOR-friendly

  • bits
  • space
Reach for

Bit tricks (XOR, low bit, masks)

XOR cancels pairs; a^a=0. Many O(1)-space tricks come from bit identities.

Where this comes from

Knowing the signal is half of it

The other half is turning the pattern into correct code while someone watches. Every module above builds the structure from scratch in Go, steps through it visually, and then hands you exercises with reference solutions and a grading prompt. Reading the problem is module 01; the rest is the course.

Get lifetime access — £39one-time · £39 · 2 modules + a mock interview free first