ASAPUtils Logo ASAPUtils
12-week plan

DSA & Problem Solving

A free, account-free study system for data structures, algorithms, and interview preparation. Every algorithm runs step by step in your browser, with C++ and JavaScript solutions side by side.

Start here, not with problem #1

If pyramid patterns are hard and tree traversal is hard, that is one gap, not two. Both are the same skill: holding evolving program state in your head. Week 0 fixes that before any LeetCode problem gets touched — because doing the 150 without it is how you end up having "done" a list you can't reproduce.

Available now

23 of 50 units written. This grows one week at a time.

How to Read a Problem
The first five minutes of a coding interview decide the rest of it. A repeatable routine for parsing a problem, finding the constraints, working examples by hand, and identifying the pattern before you write any code.
Foundations Week 0
Big-O & Reading Constraints
Estimate time and space complexity in seconds, and use the input constraints to work out the target complexity before you have thought of an algorithm. The fastest way to know your idea is wrong.
Foundations Week 0
Loops, Indices & Pattern Printing
Nested loops, index arithmetic, and loop invariants — taught through star patterns and pyramids. This is the skill that later makes tree traversal, two pointers, and DP tables feel obvious instead of impossible.
Foundations Week 0
Recursion & the Call Stack
Recursion is a function that pauses itself. Learn to draw the call stack and the call tree, and to answer the one question that unlocks nearly every tree problem: what does this call return to its parent?
Foundations Week 0
Memory Model — C++ vs JavaScript
What a vector, an array, a hash map and a string actually are in memory, and how C++ and JavaScript differ. Knowing this is why "just use a hash map" stops being a magic phrase and starts being a trade you can price.
Foundations Week 0
Arrays
What an array actually is in memory, why appending is amortised O(1) but inserting is O(n), and the handful of signals that tell you the answer is a single pass rather than a nested loop.
Data structures Week 1
Strings
Strings are arrays of characters with one crucial difference between C++ and JavaScript — mutability. Frequency counting, character arithmetic, and the building trap that turns an O(n) loop into O(n squared).
Data structures Week 1
Hash Maps & Sets
The single highest-leverage data structure in interviews. What a hash map costs, why it turns O(n squared) scans into O(n) passes, and the exact phrases in a problem statement that should make you reach for one.
Data structures Week 1
Stack (LIFO)
Learn what a stack stores, why last-in-first-out order models nested work, and how push, pop, and top power parsing, undo, recursion, and monotonic-stack interview problems in C++ and JavaScript.
Data structures Week 3
Queue and Deque (FIFO)
Understand first-in-first-out queues and double-ended queues, their C++ and JavaScript implementations, and why BFS, level-order traversal, scheduling, and sliding-window algorithms depend on processing items in arrival order.
Data structures Week 3
Two Pointers
Two indices walking a sorted array from opposite ends, discarding half the remaining possibilities at every step. The template is four lines — the part worth learning is the argument for why discarding is safe.
Patterns Week 1
Frequency Counting
Count first, then answer the question. The pattern behind anagrams, duplicates, top-k, and grouping — plus when a 26-slot array beats a hash map and when a canonical key beats both.
Patterns Week 1
Sliding Window (Fixed Size)
When the window size never changes there is no shrink loop — one element enters and one leaves on every step. The simpler half of the sliding window family, and the right place to start.
Patterns Week 2
Sliding Window (Variable Size)
Expand right always, shrink left while invalid, record when valid. One template covers longest-substring, character replacement, and minimum window — the only thing that changes is the definition of invalid.
Patterns Week 2
Prefix Sums
Precompute running totals so any range sum becomes one subtraction. The pattern that answers many range queries in O(1) each, and the one that rescues subarray problems when negative numbers break the sliding window.
Patterns Week 2
Monotonic Stack
Recognize next-greater, next-smaller, span, and histogram problems; learn the increasing and decreasing stack invariants; and understand why nested pop loops still run in O(n) across the full algorithm.
Patterns Week 3
Binary Search
Learn binary search through interval invariants, exact lookup and boundary templates, overflow-safe midpoint calculation, rotated arrays, virtual indexing, and common off-by-one failures in C++ and JavaScript.
Patterns Week 4
Binary Search on the Answer
Turn optimization problems into monotone feasibility checks, choose safe numeric bounds, and find the minimum feasible or maximum feasible answer with reusable C++ and JavaScript binary-search templates.
Patterns Week 4
Sorting and Comparators
Learn when sorting is the optimization, what ordering buys, stable versus unstable behavior, numeric and custom comparators in C++ and JavaScript, and the strict-order rules that prevent subtle interview bugs.
Patterns Week 4
Cyclic Sort and Index Placement
Learn the O(n), O(1)-space index-placement pattern for arrays containing values from 1 through n, including missing and duplicate variants, loop invariants, safe swaps, and C++ plus JavaScript templates.
Patterns Week 4
Linked Lists
Learn singly and doubly linked lists as nodes connected by references, with pointer-safe traversal, dummy heads, insertion and deletion costs, C++ and JavaScript node models, and interactive link diagrams.
Data structures Week 5
Fast and Slow Pointers
Master Floyd's fast-and-slow pointer pattern for cycle detection, cycle entrances, linked-list middles, and fixed gaps from the end, with proofs, C++ and JavaScript templates, and step-by-step traces.
Patterns Week 5
In-Place Linked-List Reversal
Learn the prev-curr-next reversal invariant for whole lists, sublists, and fixed-size groups, including safe pointer ordering, reconnection rules, C++ and JavaScript templates, and interactive link traces.
Patterns Week 5

The 12-week plan

One pattern per week, because the fourth sliding-window problem takes a fraction of the time the first did. 46 problems written up so far.

Week Focus
0 Foundations & scaffolding
1 Arrays, Hashing, Two Pointers
2 Sliding Window, Prefix Sum
3 Stack & Monotonic Stack
4 Binary Search & Sorting
5 Linked Lists
6 Trees I — traversal
7 BST, Trie, Heap
8 Backtracking
9 Graphs
10 Greedy, 1-D DP, Kadane
11 2-D DP, Intervals, Matrix
12 Bit, Math, Mock interviews

How this is built

Every algorithm here is instrumented rather than animated: the JavaScript implementation is a generator that yields a snapshot of its own state at each interesting step, and a small set of renderers draws those snapshots. That's why the same player works for an array walk, a recursion tree, and a pyramid loop — and why stepping backwards works.

The C++ pane is line-for-line equivalent and never executed in the browser; both panes carry the same step markers, so the highlighted line follows you when you switch language tabs.

Progress lives in localStorage — no account, nothing uploaded, exportable as JSON. Same promise as the rest of ASAPUtils.