Coding Interviews
Stop memorizing 500 problems. Learn the ~15 patterns behind them, with templates, complexity analysis and the signals that tell you which pattern to reach for.
Getting Started
- Introduction — How coding rounds are run and scored, and the 4 things interviewers watch for.
- How to Prepare — Pattern-first practice, spaced repetition and how many problems is enough.
- Communicating While You Code — What to say while clarifying, choosing an approach, coding, testing and when you're stuck.
- Online Assessments — Timed, auto-graded tests: formats, hidden tests, partial credit, pacing and integrity rules.
- Big-O Cheat Sheet — Complexities of core data structures and how input size hints at the solution.
- Python for Interviews — The standard-library toolkit, sorting keys, heap tiebreakers and the traps that cause wrong answers.
- Common Mistakes — The 15 process mistakes that sink coding rounds — and what to do instead.
Patterns
- Hash Maps & Sets — Counting, complements, grouping and prefix sums.
- Prefix Sums & Difference Arrays — Range sums in O(1), counting subarrays with a hash map, and batched range updates.
- Matrices — Rotation, spiral order, in-place state tricks and searching sorted matrices.
- Sorting & Quickselect — Custom comparators, quickselect, counting and bucket sort, and merge-sort counting.
- String Matching — Rolling hashes (Rabin–Karp) and the prefix function (KMP), and when to use each.
- Two Pointers — Opposite-end and fast/slow pointers on sorted arrays and linked lists.
- Linked Lists — Dummy heads, reversal, fast/slow pointers and merging without losing nodes.
- Sliding Window — Fixed and variable windows for subarray and substring problems.
- Binary Search — Classic search, boundary search, and binary search on the answer.
- BFS & DFS — Tree and graph traversal, grids, shortest paths in unweighted graphs.
- Binary Trees — Recursive return contracts, traversal orders, the global-answer pattern and LCA.
- Binary Search Trees — Validation with bounds, inorder = sorted, LCA, deletion and balanced builds.
- Heaps & Top-K — Top-K, k-way merge, running medians and scheduling.
- Intervals — Sort-then-sweep for merging, inserting and meeting-room problems.
- Monotonic Stack — Next greater element, histograms and stock spans in O(n).
- Stacks, Queues & Deques — Matching and nesting, expression evaluation, queues and the monotonic deque.
- Backtracking — Subsets, permutations, combinations and constraint search.
- Dynamic Programming — From recursion to memoization to tabulation — with the common DP shapes.
- DP: Knapsack Patterns — 0/1 vs unbounded, loop direction, combinations vs permutations, and spotting hidden knapsacks.
- DP on Strings — Two-string prefix tables, regex and wildcard matching, palindromes and splitting strings.
- DP: State Machines & Intervals — The stock problems as state machines, and interval DP by choosing what happens last.
- Greedy — When greedy works, exchange arguments, and the six common greedy shapes.
- Graphs: Topo Sort & Dijkstra — Dependency ordering, cycle detection and weighted shortest paths.
- Advanced Graphs — Multi-source BFS, bipartite checks, minimum spanning trees, bridges and Euler paths.
- Union-Find — Connected components and dynamic connectivity in near-constant time.
- Trie — Prefix search, autocomplete and word-search problems.
- Segment & Fenwick Trees — Range queries with updates in O(log n), counting with coordinate compression, and range updates.
- Bit Manipulation — XOR tricks, counting bits, bitmasks as sets and arithmetic without operators.
- Math & Number Theory — GCD, primes, fast exponentiation, modular arithmetic and careful digit handling.
- Design-a-Data-Structure Questions — Combining maps, lists, heaps and binary search to hit every operation's target complexity.
- Practical Multi-Part Rounds — Building an in-memory store or bank in levels: spec reading, data models and traps.