The DSA sheet, grouped by pattern

231 problems across 14 topics. Each topic is split into the patterns it teaches, so you practise the idea behind a problem and not just the problem. Work through them in roadmap order, or open the topic your next class covers.

Track your progress
  1. Arrays & Hashing

    Most interview problems start with an array. The patterns here teach you to avoid the nested loop: keep a running total, move two pointers toward each other, or slide a window across the input so every element is visited once.

    13 patterns: Two Sum, Moore's Voting Algorithm, Kadane's Algorithm, Double Reversal Trick, Two Pointer, Right to Left Traversal, In-place Transformations, Merge Sort Like Approach, Dutch National Flag, Prefix Sum Strategy, Sliding Window · Fixed, Sliding Window · Variable, Sliding Window · Hash Map

    28 problems

  2. Stack

    A stack remembers the most recent thing you have not dealt with yet. That makes it the natural tool for matching brackets, undoing operations, simulating collisions and evaluating expressions.

    1 patterns: Stack Basics

    7 problems

  3. Monotonic Stack

    A monotonic stack keeps its items in increasing or decreasing order, popping anything that breaks the order. Each pop answers a question like "what is the next greater element?" for the item being removed, all in one pass.

    1 patterns: Monotonic Stack

    4 problems

  4. Linked List

    Linked list problems are about pointer discipline. A dummy node removes head edge cases, slow and fast pointers find middles and cycles, and careful reversal handles everything from palindromes to k-group swaps.

    5 patterns: Dummy Node Pattern, Slow Fast Pointers, Front Back Pointer, Front Middle Back Pointer, Miscellaneous

    20 problems

  5. Binary Search

    Binary search works on anything with a sorted or monotonic shape, not just sorted arrays. Once bisect_left and bisect_right are second nature, rotated arrays, 2D matrices and "minimum speed that works" problems all use the same loop.

    7 patterns: Basics, Bisect, Unique 1-D Binary Search, Rotated Array, 2D Binary Search + Step Search, Search on Answer Range, Binary Search on Answer Space

    25 problems

  6. Recursion & Backtracking

    Backtracking explores every choice, undoes it, and tries the next. Learn the pick / not-pick tree once and subsets, combinations, permutations, N-Queens and word search become variations on the same template.

    5 patterns: Basic Recursion, 2D Matrix, Pick / Not-Pick, Permutations, 2D Matrix Backtracking

    17 problems

  7. Trees & BST

    Trees are recursion with structure. Traversals come first, then postorder with multiple return values, LCA, views, serialization and the BST property. Most tree problems reduce to deciding what each call returns to its parent.

    12 patterns: Recursion, Backtracking, Traversals, Views, BST Basics, Postorder + Multiple Return Values, LCA, Child + Ancestor Handling, Reverse Inorder Traversal, Tree Serialization / Deserialization, Tree to Lists and vice-versa, Miscellaneous BST Questions

    43 problems

  8. Heaps

    A heap gives you the smallest or largest item in O(log n) while items keep arriving. It is the standard answer to top-k, kth largest and merging k sorted sources.

    4 patterns: Top K / Kth Largest / Smallest, Composite comparator, Merge K Sorted, Advanced

    6 problems

  9. Intervals

    Interval problems become simple once the intervals are sorted. From there you merge, intersect, or sweep a line across start and end events to count how many overlap at once.

    2 patterns: Basics, Line Sweep

    9 problems

  10. Tries

    A trie stores words character by character so prefix queries cost the length of the prefix, not the size of the dictionary. Build one by hand before reaching for it in word search and autocomplete problems.

    1 patterns: Basics

    2 problems

  11. Graphs

    Graphs show up as grids, dependencies and networks. BFS finds shortest paths in unweighted graphs, DFS explores components, topological sort orders dependencies, and Dijkstra handles weighted edges.

    9 patterns: BFS / DFS Basics, Matrix Graphs, Connected Components, BFS for shortest path, DFS - Complement Trick, Multi source BFS, Cycle Detection, Topological Sort, Dijkstra

    18 problems

  12. Dynamic Programming

    Dynamic programming is recursion that remembers. Start from the recursive choice, add memoisation, then turn it into a table. The patterns move from 1D and grid DP to stock state machines, knapsack, string alignment and interval DP.

    9 patterns: 1D DP, Alternate Selection / Pick / Not pick, 2D DP, 2D DP - max/min of last row, Squares, State Machine DP - Stock Problems, Knapsack, Strings, Interval DP

    34 problems

  13. Bit Manipulation

    Bit tricks turn some problems into one line. XOR cancels pairs, n & (n - 1) clears the lowest set bit, and shifting checks any single bit. Worth knowing for the missing and repeated number family.

    4 patterns: Basics, Tricks to remember, XOR Basics, Missing / Repeated Numbers

    12 problems

  14. Design Data Structures

    Design problems ask you to build a class with fast operations. The skill is choosing the right trade-off: pre-compute on insert or on query, and pick a structure that makes every operation fit the target complexity.

    3 patterns: Pre-processing + tradeoffs, Linked Lists, Stack

    6 problems