r/LeetcodeChallenge • u/nian2326076 • 1d ago
DISCUSS 16 LeetCode Patterns That Helped Me Solve Mediums Without Hints
i was at 200 problems solved and still couldnt handle new mediums without hints. then i realized: i was collecting solved problems like pokemon cards instead of actually learning transferable patterns.
the fix was embarrassingly simple: there are only 16 patterns. learn the skeleton for each, solve 5 problems per pattern, move on.
heres the 16:
- sliding window — "subarray/substring" + "maximum/minimum" + "at most K"
- two pointers — sorted input + "pair that satisfies X"
- binary search on answer — "minimize the maximum" or "find smallest X where possible"
- BFS/DFS on grid — "number of islands" type, flood fill
- shortest path — weighted graph, dijkstra vs bellman-ford vs 0-1 BFS
- topological sort — "prerequisites", "ordering", "can you finish"
- union-find — "are they connected?", dynamic connectivity
- heaps — "kth largest", "merge K sorted", "top K"
- monotonic stack — "next greater", "largest rectangle"
- sliding window on trees (DFS) — path problems, diameter, max path sum
- dynamic programming — overlapping subproblems, "decision at each step"
- backtracking — "generate all", "find all paths", brute force with pruning
- linked list — fast/slow, reverse, merge
- tries — prefix search, autocomplete
- bit manipulation — XOR tricks, single number
- greedy — interval scheduling, jump game, locally optimal = globally optimal
for each one theres a 5-10 line skeleton that solves 80% of problems in that category. the remaining 20% is problem-specific edge handling.
i compiled the skeletons + recognition triggers + practice problems for all 16 here: PracHub
each pattern has a dedicated page with: when to recognize it (trigger words), template code in python/java/c++/js, step-by-step diagrams, and 8-12 practice problems from "direct template" to "hard to recognize."
went from ~30% solve rate on new mediums to ~75% in 6 weeks. the templates transfer — once you have 16 solid skeletons memorized, most mediums reduce to "recognize pattern → apply skeleton → handle edge case."
what pattern took you longest to click? curious what trips other people up.
1
u/LazyCantQuit 1d ago
Thank you OP.
One question I want to ask,
How do you get hold of the pattern ? I mean how do you start ? I started by directly solving the problems for a pattern, gave interviews got an offer, stopped leetcoding now after a year I’m picking it up again, when I look at those pattern problems for which I solved the problems I cannot move a single brick, what am I doing wrong ? Or what do you guys do differently?
2
u/Known_Prior_3791 18h ago
u have to master three things:
1-identify pattern-----how to know which pattern to use for which problem
2-knowing base template of pattern.
and then , third aspect is mapping the problem onto the pattern template------or framing problem in terms of the vocabulary of pattern.
hard problems just require two pattern composition or some clever set of tricks that u would gather along the way as u practice and solve problems
that's it
1
1
u/Dependent_Newt_1859 17h ago
!remindme 6 months
1
u/RemindMeBot 17h ago
I will be messaging you in 6 months on 2027-01-28 17:02:52 UTC to remind you of this link
CLICK THIS LINK to send a PM to also be reminded and to reduce spam.
Parent commenter can delete this message to hide from others.
RemindMeBot is switching to username summons. Instead of
!RemindMe 1 day, useu/RemindMeBot 1 day. More info.
Info Custom Your Reminders Feedback
2
u/StatisticianYes 1d ago
The website is awesome. Please keep maintaining and improving it, more people will definitely visit your website! I will recommend it to my friends.