23 patterns · 23 available now

Stop memorizing solutions.
Start recognizing patterns.

LeetCode has thousands of problems and roughly twenty ideas. PatternDSA teaches those ideas one at a time: the signal that tells you which pattern applies, the mechanism in plain language, an interactive visualization, and the problems that drill it.

the patterns

Pick where to start

View all
TWBeginner

Two Pointers

Converge from both ends of a sorted structure to kill a nested loop.

SLBeginner

Sliding Window

Maintain a contiguous range and amortise the work as it grows and shrinks.

FAIntermediate

Fast & Slow Pointers

Two speeds through a sequence expose cycles and midpoints in O(1) space.

BIBeginner

Binary Search

Halve the candidate space using a monotone yes/no test.

BIIntermediate

Binary Tree Traversal (BFS/DFS)

Choose depth or breadth based on whether the answer is a path or a level.

DYAdvanced

Dynamic Programming

Name the state, write the transition, then decide memo or table.

PRBeginner

Prefix Sum

Precompute cumulative totals to answer range queries in O(1).

MOIntermediate

Modified Binary Search

Binary search on an answer range instead of an array index.

MAIntermediate

Matrix Traversal

Treat a grid as a graph and flood, spiral, or rotate it in place.

TRIntermediate

Tree BFS

Level-by-level expansion for depth-indexed answers.

TRIntermediate

Tree DFS

Recursion that passes context down and aggregates results up.

GRIntermediate

Graph BFS / DFS

Explore nodes with a visited set; BFS for shortest unweighted paths.

TOAdvanced

Topological Sort

Order a DAG by repeatedly removing zero in-degree nodes.

MOAdvanced

Monotonic Stack

A sorted-by-construction stack answers next-greater in one pass.

TOIntermediate

Top K Elements (Heaps)

Keep a size-K heap instead of sorting the whole input.

TWAdvanced

Two Heaps

Balance a max-heap and a min-heap to track the middle of a stream.

UNAdvanced

Union-Find

Near-constant merges and connectivity queries via disjoint sets.

TRIntermediate

Trie

Share prefixes in a character tree for fast lookup and autocomplete.

BIAdvanced

Bit Manipulation

XOR, masks and shifts replace whole data structures.

LIIntermediate

Linked List In-place Reversal

Rewire next pointers with three cursors and no extra memory.

OVIntermediate

Overlapping Intervals

Sort by start, then merge or count overlaps in one sweep.

BAAdvanced

Backtracking

Enumerate choices, prune dead branches, undo and continue.

GRIntermediate

Greedy Algorithms

Take the locally best step when an exchange argument proves it safe.

why patterns, not problems
01

20 patterns cover 90% of interview questions

The problem count is a distraction. Learn the recurring techniques and unseen questions start looking familiar.

02

Visual-first learning

Every pattern ships with a step-through visualization so you watch pointers move and tables fill instead of squinting at code.

03

Curated practice, not random grinding

Four to six hand-picked LeetCode problems per pattern, ordered so each one drills the same idea from a new angle.

We use analytics to understand how learners use PatternDSA. No personal data is collected.