DSA Interview Prep
A pattern-first path through coding interviews: the techniques that recur, the structures behind them, and the loop they sit inside.
Make this roadmap your plan
Sign in to save your routine, streaks, notes, and progress across devices.
Groundwork
The habits and vocabulary every later pattern assumes you already have.
Talking about complexity out loud
beginner1hState and defend a time and space bound before you write code. Amortised analysis, the difference between worst and expected case, and why "O(n log n) because I sort" is a complete answer.
Reading the problem before solving it
beginner45mRestating the problem, extracting the constraints, and choosing a brute force you can actually explain. Most failed interviews are lost in the first four minutes.
Edge cases and off-by-one
beginner45mEmpty input, one element, all-equal, integer overflow, and the boundary you always get wrong. A checklist you run before saying you are done.
Dry-running code on paper
beginner45mTracing your own solution against an example without executing it, which is the only debugging tool you have in an interview.
Linear patterns
The array and string techniques that account for a third of every interview loop.
Two pointers
beginner1h 30mOpposite ends, same direction, and fast/slow. Recognising when a sorted input lets you drop a nested loop.
Sliding window
beginner1h 30mFixed and variable windows, and the "shrink while invalid" loop shape that makes variable windows one template rather than ten problems.
Prefix sums and difference arrays
beginner1h 15mTurning repeated range queries into O(1) lookups, and the prefix-sum-plus-hashmap trick behind subarray-sum problems.
Hash maps and frequency counting
beginner1h 15mGrouping, deduplication, and the seen-set. Where a hash map turns quadratic into linear and where it quietly does not.
Sorting as a preprocessing step
intermediate1h 15mWhen paying n log n up front collapses the rest of the problem, plus custom comparators and stability.
Binary search, including on the answer
intermediate1h 30mThe template that does not go out of bounds, searching rotated arrays, and binary searching a monotonic predicate rather than an array.
Structures under pressure
The data structures interviewers reach for, and the signals that tell you which one is wanted.
Stacks and the monotonic stack
intermediate1h 15mMatching, evaluation, and the next-greater-element family. Recognising a monotonic stack from the phrase "next larger".
Queues, deques and monotonic deques
intermediate1hBFS queues, circular buffers, and the sliding-window-maximum deque.
Linked lists without losing a pointer
intermediate1h 15mReversal, cycle detection, merge, and the dummy-head idiom that removes half the special cases.
Heaps and top-k
intermediate1h 15mWhen a heap beats a sort, k-th largest, merging k lists, and the two-heap running-median trick.
Binary trees and traversal
intermediate1h 30mRecursive and iterative traversals, level order, and the "return something from each subtree" recursion shape.
Binary search trees
intermediate1h 15mThe BST invariant, in-order as a sorted walk, insertion and deletion, and why a degenerate BST is a linked list.
Tries
intermediate1hPrefix trees for autocomplete and word search, and the space trade you are making against a hash set.
Union-find
intermediate1hDisjoint sets with path compression and union by rank — the structure that turns connectivity questions into near-constant time.
Graphs
Modelling first, algorithm second — most graph interviews are lost at the modelling step.
Recognising a graph problem
intermediate1hTurning a grid, a word list or a dependency description into nodes and edges, and choosing a representation.
BFS and DFS
intermediate1h 30mShortest path in an unweighted graph, connected components, and the visited-set discipline that stops infinite loops.
Topological sort and cycle detection
intermediate1h 15mKahn's algorithm and DFS colouring, and reading "can this schedule be satisfied?" as a cycle question.
Weighted shortest paths
advanced1h 30mDijkstra with a priority queue, Bellman-Ford when edges can be negative, and why Dijkstra breaks on them.
Minimum spanning trees
advanced1hKruskal on top of union-find, Prim on top of a heap, and the problems that are secretly asking for an MST.
Recursion and dynamic programming
The section people skip and then fail on. Built bottom-up from plain recursion.
Memoisation: recursion that stops repeating itself
intermediate1h 15mAdding a cache to a recursive solution and reading the state you cached as the DP state. The bridge between recursion and DP.
1D dynamic programming
intermediate1h 30mLinear DP over an array: Fibonacci-shaped recurrences, longest increasing subsequence, and rolling the table down to O(1) space.
2D dynamic programming
advanced1h 45mGrid paths, edit distance, and the two-sequence table. Drawing the table before writing the loop.
Knapsack and its disguises
advanced1h 30m0/1 and unbounded knapsack, subset sum, coin change — one recurrence wearing four different problem statements.
Greedy, and proving it works
advanced1h 15mInterval scheduling, jump games, and the exchange argument that separates a correct greedy from a plausible one.
The interview loop itself
Everything between solving the problem and getting the offer.
Thinking out loud
beginner45mNarrating your approach, stating trade-offs, and asking clarifying questions that are actually useful. Silence reads as being stuck.
Timed mock interviews
intermediate2hPractising under a clock with someone watching. The single highest-yield activity in this roadmap, and the one most people skip.
Object-oriented design rounds
intermediate1h 30mDesigning a parking lot, an elevator or a deck of cards: classes, responsibilities, and the interfaces you would actually implement.
Behavioural rounds
beginner1hSTAR-structured stories with real numbers, and having four of them ready rather than inventing one under pressure.
Offers and negotiation
intermediate45mReading a compensation package, comparing offers honestly, and negotiating without burning the relationship.