Workspace / Learning hub
30 TOPICS · ZERO TO OA READY

Data structures & algorithms

Learn the pattern first, trace a small example, then try an original practice question. Work through the topics in order or jump to one you want to strengthen.

30 guided topic lessons Concepts, examples, and practice
30topics in the roadmap

Your learning path

Each lesson starts with the idea, then gives you a question to try.

30 lessons
016 practice refs

Sliding Window

Move a contiguous range through an array or string while maintaining only the information the current range needs.

Practice IDs3 · 76 · 209 · 424 · 567 · 904
Open lesson
026 practice refs

Two Pointers

Use two positions to narrow a search, compare ends, or compact data in one pass.

Practice IDs11 · 15 · 16 · 18 · 42 · 167
Open lesson
036 practice refs

Fast/Slow Pointers (Linked List)

Move two linked-list references at different speeds to detect cycles or locate a middle position.

Practice IDs141 · 142 · 19 · 876 · 160 · 234
Open lesson
046 practice refs

Binary Search on Sorted Data

Discard half the remaining sorted search space after each comparison.

Practice IDs33 · 34 · 35 · 153 · 162 · 704
Open lesson
056 practice refs

Binary Search on Answer

Search the answer range when feasibility changes monotonically as the candidate answer changes.

Practice IDs875 · 1011 · 410 · 774 · 1283 · 1482
Open lesson
066 practice refs

Hashing / Frequency Maps

Use a set or map to track what has appeared and how often, usually with constant-time average lookup.

Practice IDs1 · 49 · 128 · 217 · 242 · 347
Open lesson
076 practice refs

Prefix Sum / Running Sum

Precompute cumulative totals so range sums and counting conditions can be answered efficiently.

Practice IDs303 · 560 · 724 · 930 · 974 · 523
Open lesson
086 practice refs

Difference Array / Range Updates

Apply many interval increments cheaply, then reconstruct the final values with a running sum.

Practice IDs370 · 1094 · 1109 · 1893 · 1943 · 2381
Open lesson
096 practice refs

Monotonic Stack

Keep a stack in increasing or decreasing order to find the next greater or smaller item efficiently.

Practice IDs739 · 496 · 503 · 84 · 85 · 901
Open lesson
106 practice refs

Monotonic Queue / Deque

Maintain only useful candidates in a deque to answer moving-window minimum or maximum queries.

Practice IDs239 · 862 · 1425 · 1438 · 1499 · 1696
Open lesson
116 practice refs

Heap / Top K

Use a heap to repeatedly access the smallest or largest candidate without fully sorting everything.

Practice IDs215 · 347 · 692 · 703 · 973 · 1046
Open lesson
126 practice refs

Intervals

Sort and reason about ranges to merge overlaps, find conflicts, or select non-overlapping intervals.

Practice IDs56 · 57 · 252 · 253 · 435 · 452
Open lesson
136 practice refs

Greedy Scheduling / Sorting

Sort by a useful criterion and make locally optimal choices when an exchange argument supports them.

Practice IDs45 · 55 · 406 · 621 · 763 · 134
Open lesson
146 practice refs

Linked List Manipulation

Rewire node references carefully to reverse, merge, split, or transform lists in place.

Practice IDs21 · 23 · 24 · 25 · 92 · 138
Open lesson
156 practice refs

Tree DFS

Explore a tree recursively or with a stack, combining information from child subtrees.

Practice IDs104 · 112 · 113 · 543 · 124 · 226
Open lesson
166 practice refs

Tree BFS / Level Order

Use a queue to visit tree nodes in layers, from the root outward.

Practice IDs102 · 103 · 199 · 515 · 637 · 116
Open lesson
176 practice refs

BST Problems

Use the binary search tree ordering invariant to search, validate, and select values efficiently.

Practice IDs98 · 99 · 230 · 235 · 450 · 700
Open lesson
186 practice refs

Backtracking Basics

Build candidate solutions step by step and undo each choice when exploring another branch.

Practice IDs46 · 47 · 77 · 78 · 90 · 39
Open lesson
196 practice refs

Backtracking with Constraints

Prune partial choices as soon as they cannot lead to a valid complete solution.

Practice IDs40 · 17 · 79 · 131 · 51 · 52
Open lesson
206 practice refs

Graph BFS / DFS

Traverse connected vertices while recording which nodes have already been visited.

Practice IDs200 · 695 · 733 · 994 · 1091 · 1254
Open lesson
216 practice refs

Topological Sort / DAG

Order directed acyclic graph nodes so every prerequisite appears before the work that depends on it.

Practice IDs207 · 210 · 802 · 1462 · 1203 · 2115
Open lesson
226 practice refs

Union Find / DSU

Track disjoint connected groups with near-constant amortized merge and find operations.

Practice IDs547 · 684 · 1319 · 1579 · 990 · 1202
Open lesson
236 practice refs

Shortest Path

Choose a graph algorithm that matches edge weights and the path objective.

Practice IDs743 · 787 · 1514 · 1631 · 1334 · 1976
Open lesson
246 practice refs

MST / Graph Greedy

Connect every vertex with minimum total edge weight while avoiding cycles.

Practice IDs1584 · 1135 · 1168 · 1489 · 778 · 1102
Open lesson
256 practice refs

Trie

Store words by shared prefixes to support efficient prefix search and dictionary lookup.

Practice IDs208 · 211 · 212 · 648 · 677 · 1268
Open lesson
266 practice refs

Bit Manipulation

Use binary representations and bitwise operations to solve compact state and parity problems.

Practice IDs136 · 137 · 191 · 338 · 268 · 190
Open lesson
276 practice refs

1D DP Basics

Reuse answers to smaller prefixes or states instead of recomputing the same subproblems.

Practice IDs70 · 198 · 213 · 322 · 279 · 300
Open lesson
286 practice refs

Knapsack / Subset DP

Track which capacities, sums, or resource combinations are reachable as items are considered.

Practice IDs416 · 494 · 518 · 474 · 1049 · 879
Open lesson
296 practice refs

Grid DP

Compute paths or costs in a grid by combining answers from neighboring cells.

Practice IDs62 · 63 · 64 · 221 · 931 · 120
Open lesson
306 practice refs

String DP / Sequence DP

Use a table of prefix states to compare sequences, edit strings, or count subsequence relationships.

Practice IDs1143 · 72 · 115 · 583 · 97 · 1312
Open lesson