DSA roadmap

Coding interview roadmap

A clear map of DSA patterns for interviews — what to learn, in what order, and which Lattice posts to open for templates.

The map

Pattern roadmap
Arrays → search → trees/graphs → DP.
01Week 1–2

Arrays · windows · search

02Week 3

Stack · heap · lists · trees

03Week 4

Graphs · intervals

04Week 5+

BT · DP · bits · trie

  1. Arrays & hash maps
  2. Strings (palindrome · expand center · encode)
  3. Two pointers & sliding window
  4. Binary search · Stacks & heaps
  5. Linked lists · Trees & BST
  6. Graphs · Intervals & greedy
  7. Union-Find · Bit manipulation
  8. Backtracking · DP
  9. Prefix sums · tries · matrices

Use the ordered list below as a curriculum spine. Each link is a Lattice deep dive with templates and traces — work them top to bottom unless a company guide says otherwise.

How to navigate the coding path

What staff loops add

Staff coding bar
Clarity, invariants, follow-ups.

Why pattern-first beats random grinding

Random LeetCode streaks feel productive and still leave you blank when the interviewer renames the problem. Lattice prep is pattern-first: learn the move, then costume-change it across titles. This page is the 4–6 week plan that turns that idea into calendar blocks.

4–6 week plan (weekly goals)

01Week 1

Arrays · hash · windows

02Week 2

Search · stack · heap

03Week 3

Lists · trees · BST

04Week 4

Graphs · Union-Find · intervals

05Week 5

BT · DP · prefix/trie

06Week 6

Mocks · company polish

Week 1 — linear scans. Start with arrays & hash maps, then finish two pointers & sliding window. Goal: Two Sum / frequency map plus opposite-end pair sum and one variable window, each coded from memory with a dry-run table. Done: 6 problems (2 hash-map, 2 two-pointer, 2 window), each with complexity said aloud.

Week 2 — search & priority. Binary search (classic + search-on-answer) and stacks & heaps. Done: lower_bound template + one monotonic-stack + one top-K heap, each with an invariant sentence.

Week 3 — pointers & recursion. Linked lists and trees & BST. Done: reverse / cycle / merge list drills; tree DFS with an explicit return contract; one BST validate.

Week 4 — graphs & intervals. Graphs (BFS / topo) and intervals & greedy. Done: grid BFS shortest path, Kahn’s algorithm on a DAG, merge intervals, one greedy proof sketch.

Week 5 — search space & state. Backtracking, DP, and prefix / tries / matrices. Done: subsets + permutations templates; one 1D DP and one 2D DP stated as state→transition→base; one prefix-sum range query.

Week 6 (optional stretch) — timed mocks. Two full 45-minute mocks per week (plain editor, no autocomplete). After each: rewrite the talk track in 5 bullets. Revisit weak patterns from the hub pages search / stacks / heaps and backtracking / DP.

Mock cadence & what “done” looks like

  1. Daily (60–90 min): 1 template review (10 min) + 2 fresh mediums (timed) + write 3 edge cases you almost missed.
  2. Twice weekly: 45-min mock — restate, brute force verbally, implement, complexity, one follow-up verbally.
  3. Weekly review: list patterns you still rename slowly; re-drill those templates only.

One-problem session script

  1. 2 min — restate + constraints + empty / duplicates / overflow examples
  2. 3 min — brute force out loud, then name the pattern
  3. 15–20 min — implement; dry-run with a 4-row variable table before submit
  4. 5 min — complexity, edges, one alternative
  5. Stuck 8+ min — peek at pattern name only, not full code
Interview takeaway

Calendar the pattern, not the problem title. Every session ends with a spoken complexity line.

Pattern catalog — questions to master

Twenty patterns with two example questions each. Drill via the linked deep dive’s pattern bank (Python + Java solutions).

  • Arrays & hash maps — Two Sum, Group Anagrams, Longest Consecutive → post
  • Two pointers — 3Sum, Container With Most Water → post
  • Sliding window — Longest substring no repeat, Min window substring → post
  • Binary search — Rotated array, First/last position → post
  • Search on answer — Koko bananas, Split array largest sum → post
  • Monotonic stack — Daily temperatures, Largest rectangle → post
  • Heaps — Top K frequent, Merge K lists → post
  • Linked lists — Reverse, Cycle II, LRU → post
  • Trees — LCA, Diameter, Serialize → post
  • BST — Validate BST, LCA in BST → post
  • BFS — Islands, Word Ladder → post
  • Topo / cycle — Course Schedule → post
  • Dijkstra — Network Delay Time → post
  • 1D DP — Climb stairs, House robber → post
  • Knapsack-style — Coin change, Edit distance → post
  • Backtracking — Subsets, Permutations, N-Queens → post
  • Intervals — Merge, Insert, Non-overlapping → post
  • Greedy jumps — Jump Game II, Gas station → post
  • Prefix + hash — Subarray sum = K → post
  • Trie — Implement Trie, Word Search II → post
  • Matrices / multi-BFS — Set zeroes, Rotting oranges → post

Backend depth — how this roadmap feeds system design

Backend loops still start with DSA fluency. Use this roadmap as the coding spine of the interview prep plan — pattern templates first, random grinding never.

Related Lattice posts: Arrays & hash maps · Two pointers & sliding window · Interview prep plan · Backend interview checklist

← Lattice