DSA patterns · learn, then practise · free
Every coding-interview pattern, made visual.
Most interview questions are a familiar pattern in disguise. Learn the clue that gives each pattern away and watch it run step by step. Then practise it on 1,194 original problems, graded in your browser.
- topics
- 10
- patterns
- 56
- worked problems
- 274
- practice problems
- 1,194
Four patterns, one loop
6sOnce you can see the motion, the code follows. Every pattern on these pages has its own step-by-step player like this one.
56 patterns in the syllabus
The syllabus covers 56 patterns: Two Pointers, Merge Intervals, Sorting, Sliding Window, Prefix Sums, Two Pointers, Sliding Window, Hashmaps, String Manipulation, Regular Expressions, Basic Binary Search, Range Search, Allocation Problems, Counting Occurrences, Bitonic Array Search, Basic Recursive Functions, Divide & Conquer, Backtracking, Recursive Search, Fast and Slow Pointers, Dummy Node Technique, Recursion Technique, In-Place Reversal Technique, Design Problems, Monotonic Stack, Expression Evaluation, Two Stacks, Sliding Window & Monotonic Queue, Traversal, Construction, Mirror & Symmetry, Path Sum & Root to Leaf, Traversal & Search, Validation & Properties, Finding Kth Largest/Smallest, Top K Frequent Elements, Merge K Lists, Sliding Window Maximum/Minimum, Design Problems, Construction and Manipulation, With Graphs, Basic Dynamic Programming, Optimal Substructure, Interval/Range DP, Knapsack Problems, Prefix Sums, Counting Problems, Interval Partitioning, Probability & Expectations, Finding Connected Components, Shortest Path Finding, Cycle Detection, Bipartite Graph Check, Minimum Spanning Tree, Directed Acyclic Graph (DAG) Traversal, Graph Coloring.
Pattern-first
Learn the pattern, not every problem.
Interviewers rarely ask a question you have already solved. They ask one that needs a technique you should know. Here, 274 problems are grouped under the 56 patterns that solve them, so you study the technique once and use it everywhere it applies.
In the room, a new question then becomes a smaller one: which pattern does this look like? Spotting it early leaves your time for the edge cases and for explaining your thinking, which is what most interviewers are listening for.
How each pattern is taught
Step 1: Read the clue
Every pattern has a tell. A sorted array and a target sum points to two pointers. “Longest substring such that…” points to a sliding window. We name the tell first, so you stop guessing
Step 2: Watch it run
Step through the animation one frame at a time, with the data, the pointers and the rule that holds at each step all on screen. That is the part a written solution leaves out.
Step 3: Then solve it
Each pattern comes with a hand-picked LeetCode set, ordered easy to hard. Most also have an original twin in the practice set, where your code runs against graded tests.
The topics
Pick a topic. Watch the technique run.
Each topic breaks down into the handful of patterns that solve most of its problems, with an animation and a practice set for every one.
- 015 patterns
Arrays
The patterns behind most array and subarray problems — walk pointers, slide windows, and precompute totals to turn O(n²) into O(n).
Explore24 problems - 025 patterns
Strings
Two pointers, sliding windows, hashmaps, and pattern matching applied to characters and substrings.
Explore25 problems - 035 patterns
Binary Search
Halve the search space every step — on sorted arrays, and on answers, ranges, and allocations.
Explore23 problems - 044 patterns
Recursion
Solve a problem in terms of smaller versions of itself: divide & conquer, backtracking, and recursive search.
Explore18 problems - 054 patterns
Linked List
Pointer choreography — fast/slow runners, dummy heads, recursion, and in-place reversal.
Explore20 problems - 065 patterns
Stacks & Queues
LIFO and FIFO structures powering monotonic stacks, expression evaluation, and windowed queues.
Explore27 problems - 076 patterns
Binary Trees & BST
Traverse, build, compare, and validate binary trees and binary search trees.
Explore28 problems - 087 patterns
Priority Queues
Heaps that keep the best element one pop away — top-K, streaming medians, merges, and Dijkstra.
Explore35 problems - 098 patterns
Dynamic Programming
Cache overlapping subproblems and build optimal answers from optimal sub-answers.
Explore40 problems - 107 patterns
Graphs
Model things as nodes and edges, then traverse: components, shortest paths, cycles, ordering, and coloring.
Explore34 problems Then practise
1,194 practice problems, graded
The same techniques with new statements, so you can’t have seen the answer. Write the code in your browser and 15,062 tests check it.
Open the practice set
Then practise
1,194 problems. Zero you’ve memorised.
Each one is new, set as a small real task, and trains the technique of a named LeetCode problem. Write it in your browser; 15,062 tests grade it.
- 01Read a real task. A new story over a classic technique.
- 02Code it here. 7 languages, with a typed starter.
- 03Submit to the tests. A failing case shows its input, your output and the answer.
Free to read · free account to run code
How they’re built
Answers you can trust.
Practice only helps if the answers are right.
Each of the 1,194 problems passed five checks before it went live. If a wrong solution can pass the tests, the tests get fixed.
@ before publish
15,062 tests
- ✓Written from a specnever from another site's wording
- ✓Every example executedby the reference solution
- ✓Cross-checkedagainst a slow second solution
- ✓Mutation testedwrong versions must fail
- ✓Reviewedcomplexity, hint leaks, largest input
FAQ
Questions, answered.
What's the difference between the patterns and the practice problems?
The patterns teach: 10 topics, each technique animated step by step on real LeetCode problems. The practice problems test: 1,194 original problems on the same techniques, graded in your browser.
How are the practice problems different from LeetCode?
Every one is new, so you can't have seen the answer. Each names the LeetCode problem whose technique it trains, so your practice still maps onto the standard set.
Is it free?
The patterns are: every topic page, and every editorial with a free account. Every practice problem is free to read and to run in Python or JavaScript. Practice solutions and the compiled languages (Java, C++, Go, Ruby, TypeScript) are part of Pro.
Which languages can I use?
Python 3, JavaScript, TypeScript, Java, C++, Go and Ruby. Python and JavaScript run in your browser; the others run in a sandboxed runner.
Is my progress saved?
Yes, in this browser: the practice problems you've solved, your drafts and your streak. There's no ranking against other people.
Where should I start?
With Arrays if patterns are new to you. Learn a pattern, then open its practice problems from the same page.
10 topics / 1,194 problems / 15,062 tests
Learn one pattern, then prove it.
Watch it run, read when to reach for it, then solve an original problem on it against the tests. Free to read; sign in free to run your code.