Command Palette

Search for a command to run...

DSA · pattern by pattern

Stop memorising solutions.
Learn to see the pattern.

Every problem in this course is taught the same way: understand it, solve it the slow way, find what makes it slow, name the pattern that fixes it, and watch the fast solution run step by step. By the end you can face a problem you've never seen, recognise its shape, and explain your answer. It starts from zero: if you can write a loop in Java, you can start today.

35 of 45 modules live128 lessons254 problems112 animated dry runsJava · more languages soon

How every problem is taught

  1. 01

    Understand

    Restate the problem in your own words and work through the examples by hand.

  2. 02

    Brute force first

    Write the simplest correct idea and measure its cost. It's your safety net.

  3. 03

    Find the bottleneck

    Spot the repeated work that makes it slow.

  4. 04

    Name the pattern

    Match the clues in the wording to a pattern you know.

  5. 05

    Optimise

    Apply the pattern, then watch it run step by step in the dry run.

  6. 06

    Code and test

    Write clean Java, then check edge cases and the test cases.

  7. 07

    Explain

    Say why it works and what it costs, the way you would in an interview.

  8. Every problem also lists edge cases, common mistakes, follow-up questions and test cases ready for the in-browser code runner that's coming next.

The patterns you'll learn

Most interview problems are a handful of patterns in disguise. Each problem shows its pattern in colour, and each pattern page collects every problem that uses it.

The course map

45 modules from Java basics to interview simulation, in the order that builds on what you already know. The first 35 are live; the rest arrive in waves.

Foundations

  1. 00Java for DSA

    Just enough Java to write any algorithm: types, arrays, strings, classes, and the Collections you'll use every day.

    AvailableBeginner0/7
  2. 01Big-O and Complexity

    How to tell, before running anything, whether a solution will be fast enough.

    AvailableBeginner0/6

Linear

  1. 02Arrays

    The most common input in coding problems: traverse, track state in one pass, and work in place.

    AvailableBeginner0/11
  2. 03Strings

    Characters, counting, building strings efficiently, and palindromes.

    AvailableBeginner0/9
  3. 04Hashing

    Trade memory for speed: remember what you've seen and look it up in O(1).

    AvailableBeginner0/10
  4. 05Prefix Sum

    Precompute running totals once so every range question becomes a subtraction.

    AvailableBeginner0/11
  5. 06Two Pointers

    Two indexes moving with a rule, turning O(n²) pair searches into O(n).

    AvailableBeginner0/10
  6. 07Sliding Window

    Keep a window over a contiguous range and update it as it moves instead of recomputing.

    AvailableIntermediate0/11
  7. 08Linked Lists

    Nodes and next pointers: reversal, dummy heads, fast and slow pointers, and merging.

    AvailableIntermediate0/13
  8. 09Stack and Monotonic Stack

    Last in, first out: matching brackets and the next-greater-element family.

    Wave 2Intermediate0/11
  9. 10Queue, Deque and Monotonic Queue

    First in, first out, both ends, and the sliding-window maximum trick.

    Wave 2Intermediate0/8

Recursion & Search

  1. 11Binary Search

    Halve the search space each step, on indexes and on answers.

    Wave 2Intermediate0/13
  2. 12Recursion

    Solve a problem with a smaller copy of itself; think in base cases and trust.

    Wave 2Intermediate0/9
  3. 13Backtracking

    Build answers step by step, undo, and try the next choice.

    Wave 2Intermediate0/14
  4. 14Sorting and Divide & Conquer

    How sorts work inside, and sorting as a tool for other problems.

    Wave 2Intermediate0/11
  5. 15Intervals

    Sort by start, then merge, insert, or count overlaps.

    Wave 2Intermediate0/11

Trees

  1. 16Binary Trees

    Recursion on structure: DFS orders, level-order BFS, and returning values up the tree.

    Wave 2Intermediate0/17
  2. 17Binary Search Trees

    Ordered trees: search, insert, validate, and in-order tricks.

    Wave 2Intermediate0/12
  3. 18Heaps and Priority Queues

    Always know the smallest or largest: top-K, two heaps, and K-way merge.

    Wave 2Intermediate0/14
  4. 19Trie

    A tree of characters for prefix search and word games.

    Wave 2Intermediate0/11

Graphs

  1. 20Graph Fundamentals

    Vertices, edges, and how to store them: adjacency lists, matrices, and grids as graphs.

    Wave 3Intermediate0/10
  2. 21Breadth-First Search

    Explore level by level: shortest paths in unweighted graphs and multi-source BFS.

    Wave 3Intermediate0/11
  3. 22Depth-First Search

    Go deep first: connected components, flood fill, and path finding.

    Wave 3Intermediate0/12
  4. 23Cycle Detection

    Find loops in directed and undirected graphs.

    Wave 3Intermediate0/9
  5. 24Topological Sort

    Order tasks so every prerequisite comes first.

    Wave 3Intermediate0/10
  6. 25Union-Find (DSU)

    Merge groups and ask "same group?" in near-constant time.

    Wave 3Intermediate0/9
  7. 26Shortest Paths

    Dijkstra, Bellman-Ford and Floyd-Warshall, and when to use which.

    Wave 3Advanced0/10
  8. 27Minimum Spanning Trees

    Connect everything at the lowest total cost with Kruskal and Prim.

    Wave 3Advanced0/7

DP & Greedy

  1. 28DP Foundations: 1D

    From recursion to memoisation to tables: overlapping subproblems made fast.

    Wave 3Intermediate0/12
  2. 29DP on Grids

    Paths and costs on 2D grids.

    Wave 3Intermediate0/11
  3. 30Knapsack DP

    Choose items under a budget: 0/1, unbounded, and subset sums.

    Wave 3Advanced0/11
  4. 31DP on Strings and Sequences

    LIS, LCS and edit distance: comparing and growing sequences.

    Wave 3Advanced0/12
  5. 32Advanced DP

    Interval, bitmask, tree and state-machine DP.

    Wave 3Advanced0/13
  6. 33Greedy Algorithms

    Take the locally best choice, and learn how to prove it's safe.

    Wave 3Intermediate0/13
  7. 34Bit Manipulation

    XOR tricks, masks and counting bits.

    Wave 3Intermediate0/13

Advanced

  1. 35Advanced String Algorithms

    KMP, Z-function, rolling hashes and Manacher.

    Wave 4Advanced
  2. 36Advanced Data Structures

    Segment trees, Fenwick trees, sparse tables and ordered sets.

    Wave 4Advanced
  3. 37Advanced Graph Algorithms

    Strongly connected components, bridges, articulation points and flows.

    Wave 4Advanced
  4. 38Advanced Search and Divide & Conquer

    Ternary search, meet in the middle, and splitting problems in half.

    Wave 4Advanced
  5. 39Math for Coding Interviews

    GCD, primes, modular arithmetic, fast power and combinatorics.

    Wave 4Advanced
  6. 40Designing Data Structures

    LRU, LFU, time-based stores and other "design X" problems.

    Wave 4Advanced
  7. 41Concurrency-Aware Data Structures

    Thread-safe queues, maps and counters, and the bugs that come without them.

    Wave 4Advanced

Interview

  1. 42Pattern Recognition Drills

    Mixed problems with no labels: practise naming the pattern from the wording alone.

    Wave 4Advanced
  2. 43The Core 100

    One hundred problems that cover every pattern, in a smart order.

    Wave 4Advanced
  3. 44Interview Method and Simulation

    How to solve live: clarify, brute force, optimise, code, test, explain.

    Wave 4Advanced