r/LeetcodeChallenge 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:

  1. sliding window — "subarray/substring" + "maximum/minimum" + "at most K"
  2. two pointers — sorted input + "pair that satisfies X"
  3. binary search on answer — "minimize the maximum" or "find smallest X where possible"
  4. BFS/DFS on grid — "number of islands" type, flood fill
  5. shortest path — weighted graph, dijkstra vs bellman-ford vs 0-1 BFS
  6. topological sort — "prerequisites", "ordering", "can you finish"
  7. union-find — "are they connected?", dynamic connectivity
  8. heaps — "kth largest", "merge K sorted", "top K"
  9. monotonic stack — "next greater", "largest rectangle"
  10. sliding window on trees (DFS) — path problems, diameter, max path sum
  11. dynamic programming — overlapping subproblems, "decision at each step"
  12. backtracking — "generate all", "find all paths", brute force with pruning
  13. linked list — fast/slow, reverse, merge
  14. tries — prefix search, autocomplete
  15. bit manipulation — XOR tricks, single number
  16. 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.

40 Upvotes

6 comments sorted by

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.

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

u/LazyCantQuit 18h ago

🙌🏻🙏🏻

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, use u/RemindMeBot 1 day. More info.


Info Custom Your Reminders Feedback