Learn

Seventeen areas, taken in order. Each area is a set of patterns, and each pattern has a lesson and its problems.

  • How to think

    What DSA is, reading constraints, dry runs, and the maths, recursion, hashing and sorting you need first.

    7 patterns, 32 problems

  • Arrays

    In-place tricks, prefix sums, two pointers, sliding window and the classic array patterns.

    13 patterns, 85 problems

  • Binary search

    Searching sorted data, rotated arrays, and binary search on the answer.

    5 patterns, 40 problems

  • Strings

    Frequency, palindromes, anagrams, pattern matching and parsing.

    7 patterns, 26 problems

  • Linked lists

    Pointer manipulation: dummy nodes, fast and slow pointers, reversal and merging.

    6 patterns, 56 problems

  • Recursion and backtracking

    Exploring choices with a recursion tree and undoing them.

    11 patterns, 34 problems

  • Bit manipulation

    Working with the bits of a number.

    6 patterns, 14 problems

  • Stacks and queues

    Last-in-first-out and first-in-first-out thinking, monotonic stacks, design problems.

    8 patterns, 47 problems

  • Heaps and priority queues

    Always getting the smallest or largest next.

    5 patterns, 22 problems

  • Greedy

    Making the best local choice and knowing why it is safe.

    7 patterns, 40 problems

  • Trees

    Traversals, depth and paths, construction and serialisation.

    9 patterns, 47 problems

  • Binary search trees

    Ordered trees: search, insert, delete and queries.

    7 patterns, 26 problems

  • Graphs

    Representations, traversals, shortest paths, spanning trees and connectivity.

    12 patterns, 67 problems

  • Dynamic programming

    Recursion, memoisation, tabulation and space optimisation as one repeated recipe.

    11 patterns, 86 problems

  • Tries

    Prefix trees for words and bits.

    4 patterns, 10 problems

  • Advanced structures

    Range queries and hashing structures.

    6 patterns, 0 problems

  • Maths for DSA

    Number theory and counting tools.

    6 patterns, 3 problems