DSA — Pattern-First Problem Solving
Every product company interview in India — Flipkart, Razorpay, Zerodha, the startups you actually want — has a round where someone reads you a problem and watches you think for 45 minutes. That round filters more candidates than every resume screen combined. And the same skill it tests is what separates an engineer whose endpoint survives 10,000 users from one whose endpoint falls over: knowing what your code costs and which structure fits the job.
This track teaches that skill the only way it actually builds: pattern by pattern, in Java, with your hands on the keyboard.
Why Pattern-First
Here’s the trap most people fall into: they open LeetCode, sort by “most popular,” and grind 500 random problems. Six months later they still freeze on anything they haven’t seen, because they memorized solutions, not recognition. Each problem was a one-off fact, and facts you don’t connect, you forget.
The truth about interview DSA: almost every problem you’ll ever face is one of about a dozen patterns wearing a costume. “Longest substring without repeating characters” and “max sum of any subarray of size k” look like different problems — they’re the same pattern (sliding window) with different clothes.
So the plan is the opposite of the grind:
| The grind | Pattern-first |
|---|---|
| 500 random problems | ~15 problems per pattern |
| Memorize solutions | Train recognition |
| ”Have I seen this exact one?" | "Which pattern is this wearing?” |
| Freeze on anything new | New problem = old pattern + costume |
You solve 15 problems per pattern until the recognition is automatic — until “sorted array, find a pair” makes your hands start typing two pointers before your brain finishes the sentence. That’s roughly 150 problems total, and it beats 500 random ones every single time.
The Pattern Map
This is the whole track on one screen. The left side is what the problem says; the right side is the pattern — and module — that handles it.
flowchart LR
S1["seen before, duplicates, count things"] --> M2["02 Arrays and Hashing"]
S2["sorted input, pair sum, in place"] --> M3["03 Two Pointers"]
S3["contiguous subarray or substring"] --> M4["04 Sliding Window"]
S4["matching pairs, most recent first"] --> M5["05 Stacks"]
S5["sorted, find it in log n"] --> M6["06 Binary Search"]
S6["chain of nodes, cycle, reorder"] --> M7["07 Linked Lists"]
S7["level by level, shortest hops"] --> M8A["08 Trees with BFS"]
S8["explore every path, count regions"] --> M8B["08 Trees with DFS"]
S9["top k, kth largest, running best"] --> M9["09 Heaps and Greedy"]
S10["all combinations, all permutations"] --> M10["10 Backtracking"]
S11["how many ways, fewest steps, overlap"] --> M11["11 Dynamic Programming"]
Eleven patterns. That’s the entire vocabulary. Module 01 (Big-O) teaches you to price solutions, modules 02–11 teach the patterns one at a time, and module 12 trains you to pick the right one in 30 seconds flat.
How To Use This Track
Pace: one module ≈ 3–5 study days. Slower than the Core Java track, on purpose — pattern recognition needs reps, and reps need sleep between them.
Every module runs the same loop:
- Lesson — the pattern, the Java template, the complexity win
- Visualizer — step through the pattern moving, frame by frame
- Quiz — Spot The Pattern, where recognition gets trained
- Build — type the pattern from scratch in the terminal
- Problems — drill it until the template comes from memory
Then the part everyone skips and you won’t: re-test on day 1, 3, 7, and 21. Re-solve one problem from the module without looking. This is the same spaced-recall system as the rest of the site — the full method is in How To Study. A pattern you can’t recall in three weeks is a pattern you never learned.
One hard rule carried over from Core Java: type everything yourself. Reading a solution feels like learning. It isn’t.
The Universal Protocol
Every problem, every interview, every time — the same six steps. The third column is what you say out loud in an interview, because silent thinking reads as stuck thinking:
| Step | What you do | What you say out loud |
|---|---|---|
| 1. Understand | Restate the problem. Pin down inputs, outputs, constraints. Ask about empty input, duplicates, negatives. | ”Let me restate it to check I have it right. Can the array be empty? Are there duplicates?“ |
| 2. Match a pattern | Scan for trigger words: sorted, contiguous, top k, all combinations… | ”It is sorted and asks for a pair, so I am thinking two pointers.” |
| 3. Plan on paper | Sketch the approach on a small example BEFORE code. Walk one input through by hand. | ”Before I code, let me walk through the example: left starts here, right here…“ |
| 4. Implement | Write the pattern template first, then fill in the problem specifics. Narrate as you type. | ”I will keep a window and a set of what is inside it…“ |
| 5. Test edge cases | Empty input, one element, all duplicates, target not present, extreme values. | ”Let me trace the empty array… and the case where no answer exists.” |
| 6. State complexity | Time AND space, and the brute-force baseline you beat. | ”Brute force is O of n squared; this is O of n time, O of n space.” |
Steps 1–3 are where interviews are won. Most candidates skip straight to step 4 and code themselves into a wall.
The Modules
| # | Module | What it gives you |
|---|---|---|
| 01 | Big-O: The Cost Of Code | Price any solution before you write it — the lens every other module uses |
| 02 | Arrays & Hashing | The O(1) lookup that kills nested loops; Java HashMap in anger |
| 03 | Two Pointers | Sorted-array problems in one pass, zero extra space |
| 04 | Sliding Window | Contiguous subarray and substring problems without re-scanning |
| 05 | Stacks | Matching, nesting, and most-recent-first problems |
| 06 | Binary Search | Halve the search space — on arrays, and on answer spaces |
| 07 | Linked Lists | Pointer surgery: reverse, detect cycles, find middles in one pass |
| 08 | Trees, BFS & DFS | Walk any hierarchy or grid — level by level or path by path |
| 09 | Heaps & Greedy | Top-k and “always grab the best next thing” problems |
| 10 | Recursion & Backtracking | Generate all combinations, permutations, and paths — then prune |
| 11 | Dynamic Programming Intro | ”How many ways” and “minimum cost” when subproblems overlap |
| 12 | Which Pattern? The Decision Engine | The capstone: 30-second pattern recognition under pressure |
Can You Spot One Already?
Three problems, three different patterns. Don’t worry about scoring yet — this is your before photo:
If you guessed all three: good instincts, now make them reliable. If you missed all three: perfect, that’s exactly what the track is for.
Start here: Big-O: The Cost Of Code. Everything else in this track is measured with the ruler that module hands you.