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

推荐订阅源

博客园 - 聂微东
Y
Y Combinator Blog
WordPress大学
WordPress大学
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
A
About on SuperTechFans
小众软件
小众软件
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
GbyAI
GbyAI
I
InfoQ
The GitHub Blog
The GitHub Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
C
Check Point Blog
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
量子位
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog

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
I Solved 100+ LeetCode Problems — These Are the Patterns ...
Duong Tran Quang · 2026-06-15 · via DEV Community

Duong Tran Quang

I Solved 100+ LeetCode Problems — These Are the Patterns That Actually Matter

When I first started solving LeetCode problems, I made the same mistake many beginners make:

I tried to memorize solutions.

That approach worked for a few problems, but completely broke down once I encountered new variations.

After solving more than 100 problems, I realized that most interview questions are not testing specific solutions. They are testing whether you recognize the underlying pattern.

Instead of asking:

How do I solve this problem?

I started asking:

Which pattern is this problem testing?

That small shift changed everything.

1. Arrays & Hashing

Common problems:

  • Two Sum
  • Contains Duplicate
  • Valid Anagram
  • Group Anagrams
  • Top K Frequent Elements

Core idea:

Use hash maps and hash sets to trade memory for speed.

Typical complexity target:

  • Time: O(n)
  • Space: O(n)

2. Two Pointers

Common problems:

  • Valid Palindrome
  • Two Sum II
  • Container With Most Water
  • 3Sum

Core idea:

Move two indices through a sorted structure or from opposite ends of a sequence.

Typical complexity target:

  • Time: O(n)
  • Space: O(1)

3. Sliding Window

Common problems:

  • Best Time to Buy and Sell Stock
  • Longest Substring Without Repeating Characters
  • Minimum Window Substring
  • Permutation in String

Core idea:

Expand and shrink a window while maintaining constraints.

Typical complexity target:

  • Time: O(n)

4. Stack

Common problems:

  • Valid Parentheses
  • Min Stack
  • Daily Temperatures
  • Largest Rectangle in Histogram

Core idea:

Maintain information about previously seen elements.

Special pattern:

Monotonic Stack.

5. Binary Search

Common problems:

  • Binary Search
  • Search a 2D Matrix
  • Search in Rotated Sorted Array
  • Koko Eating Bananas

Core idea:

Search on answer space, not just on arrays.

This was one of the most important interview patterns for me.

6. Trees

Common problems:

  • Maximum Depth of Binary Tree
  • Same Tree
  • Balanced Binary Tree
  • Validate Binary Search Tree

Core idea:

Most tree questions become straightforward once you become comfortable with recursive DFS.

7. Heap / Priority Queue

Common problems:

  • Kth Largest Element in an Array
  • Last Stone Weight
  • K Closest Points to Origin
  • Find Median from Data Stream

Core idea:

Efficiently maintain the smallest or largest elements.

8. Backtracking

Common problems:

  • Subsets
  • Permutations
  • Combination Sum
  • N-Queens

Core idea:

Build a decision tree and explore all possibilities.

9. Graphs

Common problems:

  • Number of Islands
  • Clone Graph
  • Course Schedule
  • Word Ladder

Core idea:

Most graph problems reduce to DFS, BFS, or Topological Sort.

10. Dynamic Programming

Common problems:

  • Climbing Stairs
  • House Robber
  • Coin Change
  • Longest Increasing Subsequence

Core idea:

Store solutions to smaller subproblems and reuse them.

Final Thoughts

The biggest improvement in my interview preparation came from organizing problems by pattern rather than by difficulty.

Once you recognize the pattern, the implementation becomes much easier.

If you're currently learning LeetCode, focus less on memorizing solutions and more on identifying the recurring techniques behind them.

What pattern took you the longest to understand?

I recently organized detailed notes, explanations, and visual walkthroughs for these patterns on my personal site:

https://dtducas.com/blog

I'm continuously adding new problems and explanations as I work through them.