Introduction: Why You Need a Roadmap
LeetCode has over 3,000 problems and no built-in learning path. If you open the problem set and start solving at random, you will quickly hit walls — problems that require knowledge you have not yet built. This is the most common reason beginners give up within the first two weeks.
The goal of this roadmap is simple: take you from zero knowledge to solving most Medium problems in under 25 minutes within 8-12 weeks. That is the practical threshold for passing real technical interviews at mid-to-large companies.
Interview readiness — solving most Mediums in under 25 minutes — requires mastery of approximately 15-20 core DSA patterns, not knowledge of individual solutions. This roadmap is organized around those patterns, not problem counts.
Most interview failures happen because candidates learned algorithms in the wrong order — trying DP before mastering recursion and trees is the most common mistake. Each phase of this roadmap is a prerequisite for the next. Do not skip phases.
This guide is organized into four phases over 8-10 weeks of active study, plus 2 weeks of consolidation. Each phase ends with a set of target problems. When you can solve those problems without hints, you are ready to advance.
Alongside each phase, use a spaced repetition tool like YeetCode to reinforce what you have learned. Recognizing a pattern 30 days after you first saw it is what separates candidates who pass from those who blank under pressure.
Phase 1 — Core Data Structures (Weeks 1-2)
Phase 1 is about building the foundational vocabulary. Arrays, strings, hash maps, stacks, and queues appear in some form in nearly every interview problem you will ever see. If you are not fluent with these, every later phase will feel harder than it should.
Start with arrays and strings. The key operations are two-pointer traversal, sliding window, and prefix sums. These three techniques alone unlock a large class of Easy and Medium problems. Practice writing them by hand until they are automatic.
Hash maps (dictionaries) are the single most important data structure for interview problems. Their O(1) average-case lookup turns O(n^2) brute-force solutions into O(n) optimal ones. Study the pattern: iterate once to build the map, iterate once more to use it.
Stacks and queues are used for problems involving order, matching, and monotonic sequences. The classic stack problem is Valid Parentheses. Once you understand why a stack works there, the next 20 stack problems will feel familiar.
By the end of Week 2, you should be able to solve any Easy problem in these categories without hints, and make meaningful progress on related Mediums before checking solutions.
- Two Sum (LeetCode 1) — hash map lookup pattern
- Best Time to Buy and Sell Stock (LeetCode 121) — single-pass array tracking
- Contains Duplicate (LeetCode 217) — hash set membership
- Valid Anagram (LeetCode 242) — frequency counting with hash map
- Valid Parentheses (LeetCode 20) — stack matching
- Longest Substring Without Repeating Characters (LeetCode 3) — sliding window + hash set
- Product of Array Except Self (LeetCode 238) — prefix/suffix product arrays
- Minimum Stack (LeetCode 155) — stack with auxiliary tracking
- Group Anagrams (LeetCode 49) — hash map grouping by sorted key
- Top K Frequent Elements (LeetCode 347) — frequency map + heap or bucket sort
10 Must-Solve Phase 1 Problems
Two Sum, Valid Parentheses, Longest Substring Without Repeating Characters, Product of Array Except Self, Group Anagrams, Top K Frequent Elements, Contains Duplicate, Valid Anagram, Best Time to Buy and Sell Stock, Minimum Stack. These 10 cover every core Phase 1 pattern. Solve all 10 without hints before moving to Phase 2.
Phase 2 — Trees and Linked Lists (Weeks 3-4)
Phase 2 introduces pointer-based data structures. Linked lists teach you to manipulate references directly — a skill that also makes tree problems easier. Binary trees are where recursion becomes essential. If you are not comfortable writing recursive functions, spend extra time here.
For linked lists, the must-know patterns are: reversal (iterative and recursive), fast and slow pointers for cycle detection, and merge operations. These three patterns cover the majority of linked list interview problems.
Binary trees are best approached through three traversal orders: inorder, preorder, and postorder. Each traversal order is useful for different types of problems. Inorder traversal of a BST produces a sorted sequence — this property enables many BST problems.
Binary Search Trees (BSTs) add ordering constraints on top of the general tree structure. The key insight is that every BST operation — insert, delete, search — follows the same left-right comparison logic. Master this once and it applies everywhere.
The two-pointer technique from Phase 1 extends naturally here. Two pointers on a sorted array is analogous to fast/slow pointers on a linked list. Recognize the shared pattern: maintaining two positions and moving them based on some condition.
- Reverse a Linked List (LeetCode 206) — iterative and recursive reversal
- Merge Two Sorted Lists (LeetCode 21) — pointer merging
- Linked List Cycle (LeetCode 141) — fast/slow pointer cycle detection
- Reorder List (LeetCode 143) — find middle, reverse, merge
- Invert Binary Tree (LeetCode 226) — recursive tree transformation
- Maximum Depth of Binary Tree (LeetCode 104) — DFS depth counting
- Same Tree (LeetCode 100) — structural comparison recursion
- Lowest Common Ancestor of BST (LeetCode 235) — BST property traversal
- Binary Tree Level Order Traversal (LeetCode 102) — BFS with queue
- Validate Binary Search Tree (LeetCode 98) — BST constraint propagation
Phase 3 — Searching and Sorting (Weeks 5-6)
Phase 3 covers the algorithmic primitives that appear across nearly every domain. Binary search is arguably the most underestimated technique in interview prep. Most candidates know it for sorted arrays, but the real power is applying it to answer spaces — any monotone predicate can be binary searched.
Merge sort and quicksort are worth understanding deeply, not just memorizing. Merge sort's divide-and-conquer structure appears in problems like Count Inversions and Sort Linked List. Quicksort's partition step is the basis for the QuickSelect algorithm used in "Kth largest element" problems.
Heaps (priority queues) unlock a class of problems involving "top K", streaming medians, and interval scheduling. The heap data structure maintains a partial ordering that allows O(log n) insertion and O(1) min/max access. This trade-off is exactly what many interview problems require.
By the end of Phase 3, you should be able to binary search on a custom predicate, implement a merge-based sort, and use a heap for K-element selection problems. These are the building blocks for the more complex Phase 4 patterns.
A common mistake is spending too long on sorting algorithm implementation. Focus on understanding the patterns and complexity trade-offs. In interviews, you will almost always use a library sort — but you will need to explain why O(n log n) is unavoidable for comparison-based sorting.
- Binary Search (LeetCode 704) — template for all binary search variants
- Find Minimum in Rotated Sorted Array (LeetCode 153) — binary search on modified array
- Search in Rotated Sorted Array (LeetCode 33) — binary search with rotation handling
- Kth Largest Element in an Array (LeetCode 215) — QuickSelect or min-heap
- Find Median from Data Stream (LeetCode 295) — two-heap approach
- Merge K Sorted Lists (LeetCode 23) — heap-based K-way merge
- Sort Colors (LeetCode 75) — Dutch national flag / three-way partition
- Meeting Rooms II (LeetCode 253) — interval scheduling with heap
- Task Scheduler (LeetCode 621) — frequency-based greedy with heap
- K Closest Points to Origin (LeetCode 973) — max-heap with fixed size K
Phase 4 — Advanced Patterns (Weeks 7-10)
Phase 4 is where most candidates spend the most time and where the biggest interview gains are made. The four advanced patterns — graphs, dynamic programming, sliding window, and backtracking — cover the majority of Medium and Hard interview questions.
Graphs build directly on trees from Phase 2. An undirected graph is essentially a tree without the parent-child constraint. DFS and BFS from Phase 2 apply directly. The new skills here are adjacency list construction, visited tracking, cycle detection, and topological sort.
Dynamic programming (DP) is the most feared topic in interview prep. The key insight is that almost all DP problems follow one of five templates: linear DP (Fibonacci-style), 2D grid DP, DP on subsequences (LCS family), DP on intervals, or tree DP. Learn these five templates and most DP problems become pattern matching.
Sliding window is a technique rather than a data structure. The pattern is maintaining a window with two pointers and a running aggregate (sum, max, character counts). The window expands when a condition is satisfied and shrinks when it is violated. This pattern handles most substring and subarray optimization problems.
Backtracking is systematic search with pruning. The template is: make a choice, recurse, undo the choice. Problems like permutations, combinations, and Sudoku solver all follow this structure exactly. Once you internalize the template, the main skill is writing an efficient pruning condition.
Do not try to learn all four Phase 4 patterns simultaneously. Spend at least one full week on each. Graphs first (it builds on Phase 2), then sliding window (shorter ramp-up), then backtracking, then DP last (it requires the most problems to internalize).
- Number of Islands (LeetCode 200) — graph DFS/BFS flood fill
- Clone Graph (LeetCode 133) — graph traversal with hash map
- Course Schedule (LeetCode 207) — cycle detection / topological sort
- Pacific Atlantic Water Flow (LeetCode 417) — multi-source BFS
- Climbing Stairs (LeetCode 70) — linear DP template
- Coin Change (LeetCode 322) — unbounded knapsack DP
- Longest Common Subsequence (LeetCode 1143) — 2D DP on subsequences
- Minimum Window Substring (LeetCode 76) — sliding window with character counts
- Permutations (LeetCode 46) — backtracking with swap-based generation
- Word Search (LeetCode 79) — backtracking on a 2D grid
- House Robber (LeetCode 198) — DP with skip-one constraint
- Longest Increasing Subsequence (LeetCode 300) — patience sorting or O(n^2) DP
What to Do After the Roadmap
After completing all four phases, most candidates have solved 60-100 problems. The next step is targeted consolidation, not more random grinding. Identify your three weakest patterns from the roadmap and spend one week doing 5-10 additional problems in each of those areas.
The Blind 75 problem list is an excellent consolidation tool. It covers all the core patterns in a curated set of 75 problems that together represent the breadth of real interview question distributions. If you have completed this roadmap, you should be able to solve roughly 80% of Blind 75 without hints.
Mock interviews are the most underused preparation tool. Solving problems alone does not prepare you for the pressure of explaining your thinking out loud while coding. Start doing timed mock interviews — even just narrating your thought process while solving problems solo trains the verbal articulation habit.
Build a daily LeetCode habit of 1-2 problems, even after completing the roadmap. Interview skill decays quickly without practice. A 30-minute daily session maintains sharpness more effectively than occasional 4-hour cramming sessions.
Review problems you got wrong or needed hints for. Most candidates re-solve problems they already know instead of revisiting their failures. The highest-ROI study activity is confronting the specific patterns where you consistently struggle.
Phase 4 to Blind 75 Transition
After completing Phase 4, start Blind 75 immediately. Sort the Blind 75 list by the categories you found hardest in Phase 4 and do those first. Use YeetCode to add completed Blind 75 problems to a spaced repetition queue — revisiting them 7, 14, and 30 days later is what converts short-term recognition into durable pattern recall.
Conclusion: Commit to the Phases
The 8-12 week timeline is realistic for candidates studying 1-2 hours per day. If you can study more, compress the timeline. If life gets in the way, extend it. The phases are what matter, not the exact schedule.
The single most important rule: do not skip phases. Candidates who try to jump to graphs and DP without solid Phase 1 and Phase 2 foundations consistently struggle. The patterns build on each other. Arrays teach iteration, trees teach recursion, graphs extend trees, and DP requires both recursion and memoization.
Every problem you solve without a hint is a pattern you are more likely to recognize in an interview. Every problem you look up the answer to immediately is a missed opportunity. Struggle productively — attempt each problem for at least 20-30 minutes before checking solutions.
Use YeetCode alongside each phase to keep your earlier patterns sharp while you learn new ones. The goal is not to solve 500 problems. The goal is to recognize 15-20 patterns instantly and implement them correctly under time pressure. That is what gets you the offer.