Workspace

Algorithms

3 day streakD
THE BUILDING BLOCKS

A few patterns. A lot of possibilities.

Understand the idea first. The right solution starts to look familiar.

Graph algorithms

15 interactive lessons. DFS, BFS, shortest paths, spanning trees, and connectivity.

Explore graphs

Sliding window algorithms

15 interactive lessons. Fixed windows, variable windows, frequency maps, counting, and monotonic deques.

Explore sliding window

Linked list algorithms

18 interactive lessons. Pointer basics, cycles, reversal, merging, and sorting.

Explore linked lists

Tree algorithms

28 interactive lessons. Traversals, paths, views, binary search trees, and construction.

Explore trees

Stack algorithms

20 interactive lessons. Stack foundations, expressions, monotonic stacks, areas, and greedy algorithms.

Explore stacks

Binary search algorithms

20 interactive lessons. Boundaries, rotations, peaks, matrices, answer search, and two-array partitions.

Explore binary search
01Start here

Hash map lookup

Trade a little space for fast lookups. Great for counting, grouping, and finding pairs.

02Essential

Two pointers

Move inward from both ends, or move two pointers at different speeds.

03Essential

Binary search

Use a sorted range and halve the possibilities with each comparison.

04Popular

Sliding window

Maintain a useful slice of your input as its left and right boundaries move.

05Next step

Monotonic stack

Keep elements in order to find the next greater or smaller value in one pass.

06Essential

Depth-first search

Follow one branch at a time, track visited vertices, then backtrack.

A good place to start

Explore a pattern

A little guidance

Start with a pattern, read through a problem, and mark it solved when the idea clicks. Save anything you want to revisit.

New tutorials are added one at a time. Your bookmarks and solved checkmarks stay in this browser.

Explore the roadmap