Algorithms & Data Structures
Core algorithms, complexity analysis, and data structures
19 subjects · browse with filters
Two Pointers
Learn the two-pointer technique for scanning arrays and strings in O(n) time and O(1) extra space. Covers converging, fixed-gap, and in-place rewrite variants through classic interview problems like pair sums, triplets, palindromes, and container area.
Linked Lists
Linked lists are the proving ground for pointer discipline in coding interviews: this subject builds your intuition for in-place traversal and rewiring, then applies it to six problems ranging from a basic reversal to designing an O(1) LRU cache.
Backtracking
Learn backtracking, a controlled brute-force technique for exploring all valid configurations of a problem by building a solution incrementally and abandoning branches as soon as they violate a constraint. This subject covers the core recursive pattern and applies it to five classic interview problems: permutations, subsets, N-Queens, combination sums, and phone keypad letter combinations.
Heaps
Learn the binary heap / priority queue abstraction and the problem shapes it unlocks: top-k selection, merging sorted sequences, and running statistics over a stream. Covers Python's `heapq` module and four classic interview problems, from k-most-frequent strings to a live running median.
Greedy
Learn the greedy algorithm paradigm: making the locally best decision at each step in a single pass and trusting (with proof, not hope) that it leads to the globally optimal answer. This subject covers the core reasoning tools -- exchange arguments and greedy-choice invariants -- and applies them to three classic interview problems: the jump game, the gas station circuit, and candy distribution.
Hash Maps and Sets
Learn how hash maps and hash sets give near-constant-time membership, lookup, and counting, and use that power to solve classic interview problems like two-sum, Sudoku validation, matrix zeroing, longest consecutive runs, and geometric-sequence counting.
Fast and Slow Pointers
Learn Floyd's tortoise-and-hare technique for solving linked-list and sequence problems without extra memory. This subject covers cycle detection, midpoint finding, and how to recognize disguised cycle problems like Happy Number.
Dynamic Programming
Learn to recognize optimal substructure and overlapping subproblems, then build DP solutions systematically with memoization or tabulation. Covers 1D sequence DP, 2D grid/string DP, and knapsack-style DP across nine classic interview problems.
Bit Manipulation
Learn the core bitwise operators and the small set of identities — XOR cancellation, n & (n-1), n & -n — that unlock O(1)-space solutions to classic interview problems. Covers counting set bits with DP, finding a lonely element with XOR, and rearranging bits with masks and shifts.
Tries
Learn the trie (prefix tree) data structure: how it represents a set of strings as a tree of shared prefixes, why that makes prefix and wildcard queries fast, and how to combine it with DFS/backtracking to search a 2D board of letters. Covers implementing a trie from scratch, wildcard search with '.', and multi-word board search.
Sliding Windows
Learn the sliding window technique for solving string and array problems in linear time. Covers fixed-size windows for exact-length matching and variable-size windows that expand and contract based on a validity condition.
Graphs
A deep dive into graph algorithms for coding interviews: DFS, BFS, Union-Find, and Dijkstra's algorithm, applied to grids, dependency graphs, and weighted networks. You'll learn to recognize which tool a problem is asking for and implement each one cleanly under time pressure.
Binary Search
Learn the classic binary search template and its off-by-one traps, then generalize the idea to 'binary search on the answer' over monotonic predicates. Covers rotated arrays, medians of two arrays, matrix search, peak finding, and weighted sampling.
Trees
Learn how binary trees are built, traversed, and reasoned about recursively, then apply that thinking to search, balance, path, reconstruction, and serialization problems. Covers inversion, balance checks, level-order views, BST validation, lowest common ancestor, traversal-based reconstruction, max path sum, symmetry, vertical order, kth-smallest, and serialization.
Stacks
Learn how a simple last-in-first-out stack powers a huge class of interview problems: balancing brackets, evaluating expressions, and finding the next greater element in linear time. This subject builds the core stack toolkit and extends it to the monotonic stack and monotonic deque, two techniques that turn O(n^2) brute-force scans into O(n) passes.
Sort and Search
Learn how merge sort, quicksort, quickselect, and three-way partitioning work under the hood, and use them to sort a linked list in place, implement a general array sort, find the kth largest element in average O(n), and sort a three-valued array in a single pass.
Prefix Sums
Learn the prefix-sum technique for answering range-sum queries in constant time after linear preprocessing, and its two most common interview extensions: counting subarrays with a target sum using a hash map, and computing products without division using prefix/suffix products.
Math and Geometry
A tour of interview problems that don't fit a single reusable data structure — matrix simulation, digit manipulation with overflow checks, coordinate geometry, and classic recurrences. Covers spiral traversal, integer reversal, collinear points, the Josephus problem, and triangle numbers.
Intervals
Learn the interval pattern for problems that describe ranges on a number line: merging overlapping ranges, intersecting two range lists, and finding the maximum number of ranges active at once. Covers sorting-by-start and sweep-line event-counting techniques through three classic interview problems.