All levels

Data Structures and Algorithms Interview Prep

Twenty-one chapters from how to run a coding interview to every core pattern: arrays, windows, stacks, trees, graphs, backtracking and dynamic programming, with tested Python and diagrams.

21 chaptersUpdated 2026-10-02

Foundations

Chapter 1How to Approach a Coding InterviewThe six-step loop, reading constraints, thinking aloud, testing without a compiler and a practice routine.
Chapter 2Complexity Analysis and the Cost of OperationsCounting loops, recurrences, amortised cost and what common Python operations really cost.

Core patterns

Chapter 3Arrays and HashingSets, counters, canonical keys, prefix sums and prefix sum plus a hash map for subarray counts.
Chapter 4Two Pointers and Sliding WindowConverging pointers, read and write pointers, fixed and variable windows and why they are linear.
Chapter 5Stacks, Queues and Monotonic StructuresBracket matching, expression evaluation, the monotonic stack, histogram rectangles and the monotonic deque.
Chapter 6Linked ListsDummy heads, reversal, fast and slow pointers, merging, cycles and building an LRU cache.
Chapter 7Binary SearchBoundaries, rotated arrays, searching on the answer and the monotone predicate test.
Chapter 8Sorting, Intervals and QuickselectCustom sorts, merging and scheduling intervals, counting sort and quickselect.
Chapter 9Trees and Binary Search TreesTraversals, recursion on trees, BST invariants, lowest common ancestor and serialisation.
Chapter 10Heaps and Priority QueuesTop-k, k-way merge, two-heap median and scheduling with a heap.
Chapter 11Graphs: BFS, DFS and GridsRepresentations, traversal, grids as graphs, components and cycle detection.
Chapter 12Shortest Paths, Union-Find and Topological SortDijkstra, Bellman-Ford, disjoint sets and Kahn's algorithm.
Chapter 13Tries and String AlgorithmsPrefix trees, word search, KMP, rolling hashes and palindromes.

Recursion and optimisation

Chapter 14Recursion and BacktrackingSubsets, permutations, combinations, N-Queens and pruning.
Chapter 15Dynamic Programming: Foundations and 1DState, transition, memoisation versus tabulation and classic 1D problems.
Chapter 16Dynamic Programming: 2D and KnapsackGrids, strings, LCS, edit distance and knapsack variants.
Chapter 17Greedy AlgorithmsExchange arguments, interval greedy, jump games and heap-assisted greedy.

Advanced and strategy

Chapter 18Bit Manipulation and MathBit tricks, masks, gcd, primes, modular arithmetic and number puzzles.
Chapter 19Data Structure Design ProblemsLRU, LFU, min stack, randomised set, time map, hit counter and iterators.
Chapter 20Range Queries: Fenwick, Segment Trees and MorePrefix sums, difference arrays, Fenwick trees, segment trees, sparse tables and sweep lines.
Chapter 21Study Plan, Templates and Mock PlaybookA schedule, the one-page template sheet, pattern recognition and mock interview tactics.
Header Logo