惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Jina AI
Jina AI
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
I
InfoQ
L
LangChain Blog
The Cloudflare Blog
IT之家
IT之家
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
博客园 - 聂微东
美团技术团队
博客园_首页

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The 15 LeetCode patterns that cover ~90% of coding interv...
Mike H · 2026-06-19 · via DEV Community

Mike H

Grinding 500 LeetCode problems is the slow way to prep. The fast way is pattern recognition — because most interview questions are a remix of ~15 underlying patterns. Once you can name the pattern in the first 30 seconds, you stop solving from scratch and start adapting a template you already know.

Here are the 15 that, in my experience, cover the vast majority of what actually shows up. For each: the signal that tells you to reach for it, and a representative problem.

The 15 patterns

1. Sliding WindowSignal: a contiguous subarray/substring, "longest/shortest/at most K." Ex: Longest Substring Without Repeating Characters.

2. Two PointersSignal: a sorted array, or pairs/triplets that sum to a target. Ex: 3Sum, Container With Most Water.

3. Fast & Slow PointersSignal: cycles, or finding the middle of a linked list in one pass. Ex: Linked List Cycle, Happy Number.

4. Merge IntervalsSignal: overlapping intervals, scheduling, "merge/insert." Ex: Merge Intervals, Meeting Rooms II.

5. Cyclic SortSignal: an array of numbers in a known range [1..n], find missing/duplicate. Ex: Find All Numbers Disappeared in an Array.

6. In-place Linked List ReversalSignal: reverse a list (or a sublist) with O(1) space. Ex: Reverse Linked List II.

7. BFS (Tree/Graph)Signal: shortest path on an unweighted graph, or level-order traversal. Ex: Binary Tree Level Order Traversal, Word Ladder.

8. DFS (Tree/Graph)Signal: explore all paths, connected components, backtracking-ish traversal. Ex: Number of Islands, Path Sum.

9. Two HeapsSignal: you need the median of a stream, or to balance "smaller half / larger half." Ex: Find Median from Data Stream.

10. Subsets / BacktrackingSignal: generate all combinations/permutations/subsets. Ex: Subsets, Permutations, Combination Sum.

11. Modified Binary SearchSignal: a sorted (or rotated-sorted) input, or "minimize the maximum." Ex: Search in Rotated Sorted Array, Koko Eating Bananas.

12. Top K ElementsSignal: "K largest/smallest/most frequent." Reach for a heap. Ex: Kth Largest Element, Top K Frequent Elements.

13. K-way MergeSignal: merge K sorted lists/arrays. Ex: Merge k Sorted Lists.

14. Dynamic ProgrammingSignal: "count the ways," "min/max cost," or overlapping subproblems. Start with the recurrence. Ex: Coin Change, Longest Common Subsequence, House Robber.

15. Topological SortSignal: ordering with dependencies, a DAG, "can you finish?" Ex: Course Schedule.

How to actually study these (so they stick)

  1. Learn the signal, not just the solution. For each pattern, write down the words in the prompt that trigger it. That recognition is the whole game.
  2. Do 3–5 problems per pattern, not 50 random ones. Depth on one pattern beats breadth across many.
  3. Re-derive the template from memory. If you can rebuild the sliding-window skeleton on a blank page, you own it. If you're copying, you don't yet.
  4. Mix patterns once each is solid. Real interviews don't tell you the pattern — practice cold recognition.

The goal isn't to memorize 500 solutions. It's to walk in able to say, "this is a top-K problem," and reach for the heap before you've even finished reading.

I wrote the full breakdown — with template code for every pattern, Big-O, and the exact signal-words that map a prompt to a pattern — here: The 15 LeetCode Patterns That Cover 90% of Coding Interviews.

What pattern trips you up the most? For me it was two-heaps until it suddenly clicked. Curious what yours is.


Disclosure: I work on CoPilot Interview, an interview-prep tool — but this pattern list stands entirely on its own, and the linked guide is free to read.