LeetCode Roadmap for Beginners: A 12-Week Pattern Plan
Quick answer
A pattern-by-pattern LeetCode plan for beginners with a practice routine, revision schedule and a traced example.
A good LeetCode roadmap for beginners goes by pattern, not by problem number. Learn one language and Big O first, then spend about twelve weeks moving through arrays and hashing, two pointers, sliding window, stacks, binary search, linked lists, trees, graphs, heaps, backtracking and dynamic programming, solving Easy problems before Medium and revising every solved problem on a schedule.
Key takeaways
- Solve by pattern. Solving several problems on one pattern in a row tends to build recognition faster than random practice.
- Give each problem 30 to 45 minutes of honest effort before reading a solution, then re-solve it from memory two days later.
- Move from Easy to Medium once you finish most Easy problems of a pattern in under 20 minutes without hints.
- Know your language's data structure costs. In Python, a membership check is O(n) on a list and O(1) on average for a set or dict.
On this page:
- What should you know before opening LeetCode?
- Why follow patterns in this order?
- How does one pattern look in code? A sliding window trace
- How should you practise each problem?
- When should you move from Easy to Medium and Hard?
- How do you turn LeetCode practice into interview readiness?
- Frequently asked questions
Here is the twelve-week order. Problem counts are illustrative targets, not rules.
| Week | Pattern | Core idea to master | Target (illustrative) |
|---|---|---|---|
| 1 | Arrays and strings | Traversal, prefix sums, in-place updates | 12 Easy |
| 2 | Hashing | Counting, lookups in O(1), grouping | 10 Easy, 3 Medium |
| 3 | Two pointers | Sorted arrays, opposite ends, fast and slow | 8 Easy, 4 Medium |
| 4 | Sliding window | Fixed and variable windows on subarrays and substrings | 4 Easy, 8 Medium |
| 5 | Stack and queue | Matching brackets, monotonic stack, BFS queue | 6 Easy, 6 Medium |
| 6 | Binary search | Search on index and search on answer | 5 Easy, 7 Medium |
| 7 | Linked list | Reversal, cycle detection, merging | 6 Easy, 5 Medium |
| 8 | Trees | DFS, BFS, recursion on subtrees, BST property | 8 Easy, 6 Medium |
| 9 | Heaps and intervals | Top K, merging intervals, scheduling | 3 Easy, 8 Medium |
| 10 | Graphs | Grid traversal, connected components, topological sort | 10 Medium |
| 11 | Backtracking | Subsets, permutations, pruning | 8 Medium |
| 12 | Dynamic programming | 1D states, then 2D grids and strings | 4 Easy, 8 Medium |
What should you know before opening LeetCode?
You need one language you can write without autocomplete and a working sense of time complexity. Without these, even Easy problems feel random.
Checklist before week 1:
- Loops, functions, recursion basics, and string and array methods in your language. If you have not chosen one, compare Python, Java and C++ for DSA.
- Big O for common operations. Start with time complexity and Big O for beginners.
- The built-in structures: dynamic array, hash map, hash set, stack, queue.
Costs matter early. The official Python documentation on time complexity lists x in list as O(n), while key in dict and x in set are O(1) in the average case. Many beginner solutions time out only because they search a list inside a loop. Swapping it for a set fixes them.
Why follow patterns in this order?
Each pattern reuses the one before it, so the order reduces how much is new each week.
- Arrays, strings, hashing appear inside almost every later problem. Read how hash maps work if lookups still feel like magic.
- Two pointers and sliding window are optimisations of brute-force array loops.
- Stack, queue and binary search are small ideas with many disguises. See binary search explained with code.
- Linked lists and trees train pointer handling and recursion. Revise how recursion works before trees.
- Heaps and graphs build on trees and queues.
- Backtracking and dynamic programming come last because both need comfortable recursion. Start with dynamic programming basics.
LeetCode tags problems by topic and difficulty and offers curated study plans. Use the topic filter to follow this order, and check the site for its current lists, since they are updated.
How does one pattern look in code? A sliding window trace
A pattern is a reusable loop shape. Here is the variable sliding window on a classic question: find the length of the longest substring without repeating characters.
def longest_unique(s):
last = {} # character -> last index seen
start = best = 0
for i, ch in enumerate(s):
if ch in last and last[ch] >= start:
start = last[ch] + 1 # shrink window past the repeat
last[ch] = i
best = max(best, i - start + 1)
return best
print(longest_unique("abcabcbb")) # 3
print(longest_unique("abba")) # 2Trace for "abba":
- i=0, "a": window "a", best 1.
- i=1, "b": window "ab", best 2.
- i=2, "b": seen at index 1 inside the window, so start moves to 2. Window "b".
- i=3, "a": seen at index 0, but that is before start, so the window grows to "ba". Best stays 2.
The check last[ch] >= start is the line beginners miss. Once you see this shape (expand right, shrink left when a rule breaks, record the best), a dozen other substring and subarray problems become variations.
How should you practise each problem?
Use a fixed routine so every problem leaves something behind. The step-by-step approach to coding problems gives the long version. The short one:
- Read and restate the problem in one line. Write two test cases of your own, including an empty or single-element input.
- Brute force first. Say its complexity.
- Look for the pattern. Sorted input suggests two pointers or binary search. "Contiguous" suggests a window. "Top K" suggests a heap.
- Code it, then dry run on paper before pressing Run.
- Stuck for 30 to 45 minutes? Read one hint or the approach, close it, and write the code yourself.
- Log it. One line in a sheet: problem, pattern, the trick, date.
Revision schedule: re-solve from a blank editor after 2 days, 7 days and 30 days. If you fail a re-solve, the clock restarts. This is where real retention comes from.
Know your tools. In Python, use collections.deque for queues. The Python collections documentation notes that deques give approximately O(1) appends and pops from either end, while pop(0) on a list costs O(n).
When should you move from Easy to Medium and Hard?
Move up when the current level stops stretching you, measured by time and hints, not by a count.
- Easy to Medium: you solve most Easy problems in a pattern within 20 minutes with no hints.
- Medium is the main zone. Interview coding questions are often around this level, so spend the bulk of your time here.
- Hard: attempt one a week after week 8. Treat them as study material and do not let them dent your confidence.
Scenario (illustrative): Dev, a third-year student in Nagpur, has 90 minutes on weekdays. He does two new problems a day and one re-solve, and takes one timed contest on weekends. After twelve weeks he has about 150 solved problems, each revised at least twice. That beats 400 problems solved once and forgotten.
How do you turn LeetCode practice into interview readiness?
Practise under interview conditions for the last third of your preparation. Solving alone in silence is different from solving aloud with a clock.
- Timed sets: two Medium problems in 60 minutes, no hints.
- Talk while coding. Explain the approach, the complexity and the edge cases.
- Weekly contests build speed and expose weak patterns.
- Mock interviews with a friend, alternating roles.
Coding rounds are one stage among several. For example, Amazon's hiring process page lists an online application, assessments, a phone screening and an interview loop. Online assessments resemble timed practice sets, and interview loops reward clear communication. For topic priorities, see the most asked DSA interview questions.
Avoid three common mistakes: jumping between patterns daily, reading solutions within five minutes, and counting problems instead of revising them.
Next step: block the same hour every day, start week 1 from the table tonight, and create your log sheet before the first problem. For the wider plan beyond one site, use the DSA roadmap for coding interviews and this list of coding practice platforms.
Frequently asked questions
How should a beginner start LeetCode?
Learn one programming language and basic time complexity first. Then start with Easy problems on arrays, strings and hashing, and follow a pattern-wise order instead of solving random problems.
How many LeetCode problems should I solve for interviews?
There is no official number. Around 150 to 250 well-understood and revised problems across all major patterns is a common, reasonable target. Revising them matters more than adding new ones.
Is LeetCode enough for placements?
It covers the coding round well. You also need CS fundamentals such as DBMS, operating systems and OOP, projects to discuss, aptitude practice for some companies, and communication practice for interviews.
Which language is best for LeetCode?
Use the language you know best. Python is concise, Java is explicit and common in companies, and C++ is popular for contests. Interviewers judge your approach and correctness, not the language.
How long does it take to get good at LeetCode?
With 60 to 90 minutes a day, many learners feel comfortable with Easy and many Medium problems in roughly three to four months, as a rough estimate. Progress depends on consistent revision and prior programming experience.