Introduction
If you want to get 85 points out of 100, no matter your current level, this site can help you reach that goal quickly.
We use template-based and framework-based thinking, so after learning here, you can always achieve this 85-point level stably, without relying on luck. This means if a problem’s difficulty is below 85, you can always solve it step by step. For harder problems, you may need inspiration or luck.
What does 85 points mean?
For comparison, if you study computer science in college, take required data structures and algorithms classes, and use frameworks at work but never solve algorithms problems, your level is about 30~40 points. This is normal because algorithms are a special skill. It is not the same as coding experience. You need to practice specifically.
So 85 points is not low. This is enough for most technical interviews and basic contests. If you want to aim even higher, you can start by reaching 85 here first.
Site Structure
Introduction
Study Plans for Beginners and Quick Mastery
Learning Plan for Quick Mastery Learning Plan for Beginners How to Learn Algorithms Efficiently How to Practice
Tools and Algorithm Visualization
Algorithm Visualization Introduction Algorithm Game Introduction Chrome Extension for LeetCode vscode/cursor Plugin for LeetCode JetBrains Plugin for LeetCode Subscribe to this Algo Notes
Programming Language Basics
Chapter Introduction C++ Basics Java Basics Golang Basics Python Basics JavaScript Basics LeetCode Guide Let's Have Fun with LeetCode
Getting Started: Data Structures and Sorting
Implement Dynamic Arrays
Implement Single/Double Linked List
Array and LinkedList Variations
Implement Queue and Stack
Implement HashMap
Hash Table Variations
Binary Tree Structure and Traversal
Binary Tree Variations
Graph Structure and Algorithm Overview
Implement and Visualize 10 Sorting Algorithms
Chapter Introduction Key Metrics of Sorting Algorithms Explore Selection Sort in Depth Bubble Sort with Stability Insertion Sort with Reverse Thinking Shell Sort - Better than O(N^2) Quick Sort and Binary Tree Preorder Merge Sort and Binary Tree Postorder Heap Sort and Binary Heap Counting Sort: A New Pespective on Sorting Bucket Sort Radix Sort
Updating
Chapter 0. Classic Problem Solving Templates
Chapter Introduction How to Think About Data Structure and Algorithm Two Pointer Techniques for Linked List Problems Two Pointer Techniques for Array Problems Sliding Window Algorithm Code Template Thinking Recursion Algorithms from Binary Tree Perspective One Perspective + Two Thinking Patterns to Master Recursion Dynamic Programming Common Patterns and Code Template Backtracking Algorithm Common Patterns and Code Template BFS Algorithm Common Patterns and Code Template Backtracking Algorithm to Solve All Permutation/Combination/Subset Problems Greedy Algorithms Principles and Techniques Divide and Conquer Principles and Techniques Time and Space Complexity Analysis Practical Guide
Chapter 1. Data Structure Algorithms
Linked List Algorithm
Array Algorithm
Two Pointer Techniques for Array Problems Match Three Game Tricks to Traverse a 2D Array Exercise: Two Pointer Techniques for Array Game of Life One Trick to Solve All N-Sum Problems Prefix Sum Array Technique Exercise: Prefix Sum Techniques Difference Array Technique Sliding Window Algorithm Code Template Exercise: Sliding Window In Action Sliding Window Application: Rabin Karp String Matching Algorithm Binary Search Algorithm Code Template Binary Search in Action Exercise: Binary Search Algorithm Weighted Random Selection Algorithm Advantage Shuffle Algorithm
Stack/Queue Algorithm
Implement Stack with Queue, Implement Queue with Stack Exercise: Stack Problems on LeetCode Exercise: Bracket Problems on LeetCode Exercise: Queue Problems on LeetCode Monotonic Stack Code Template Exercise: Monotonic Stack Problems on LeetCode Monotonic Queue to Solve Sliding Window Problems Exercise: Monotonic Queue Implementation and Leetcode Problems
Binary Tree Algorithm
Thinking Recursion Algorithms from Binary Tree Perspective Binary Tree in Action (Traversal) Binary Tree in Action (Construction) Binary Tree in Action (Post-order) Binary Tree in Action (Serialization) Binary Search Tree in Action (In-order) Binary Search Tree in Action (Basic Operations) Binary Search Tree in Action (Construction) Binary Search Tree in Action (Post-order)
Master Binary Tree Problems
Chapter Introduction Exercise: Binary Tree Traversal I Exercise: Binary Tree Traversal II Exercise: Binary Tree Traversal III Exercise: Binary Tree Divide and Conquer I Exercise: Binary Tree Divide and Conquer II Exercise: Binary Tree Combine Two Views Exercise: Binary Tree Post-order I Exercise: Binary Tree Post-order II Exercise: Binary Tree Post-order III Exercise: Binary Tree Level I Exercise: Binary Tree Level II Exercise: Binary Search Tree I Exercise: Binary Search Tree II
Binary Tree Follow-up
Design Data Structures
Implementing LRU Cache like Building a Lego Implementing LFU Cache like Building a Lego How to Deleting Array Element in O(1) Time Exercise: Hash Table Problems on LeetCode Exercise: Priority Queue Problems on LeetCode Implementing TreeMap/TreeSet Basic Segment Tree Implementation Dynamic Segment Tree Implementation Lazy Update Segment Tree Implementation Exercise: Segment Tree Problems Implementing Trie Tree Exercise: Trie Problems on LeetCode Designing a Twitter Feed Designing an Exam Room Algorithm Exercise: Classic Design Problems on LeetCode Implement Huffman Coding Compression How to Implement a Calculator Implementing Median Algorithm with Two Binary Heaps Removing Duplicates from an Array (Hard Version)
Graph Algorithm
How to Determine a Bipartite Graph Hierholzer Algorithm to Find Eulerian Path Exercise: Eulerian Path Cycle Detection and Topological Sort Algorithm Union-Find Algorithm Exercise: Union-Find Problems on LeetCode Dijkstra Principles and Implementation Dijkstra Algorithm with Restrictions Exercise: Dijkstra Problems Kruskal Minimum Spanning Tree Algorithm Prim Minimum Spanning Tree Algorithm
Chapter 2. Brute Force Search
DFS and Backtracking Algorithm
Backtracking Algorithm Common Patterns and Code Template Backtracking in Action: Sudoku and N-Queens Implement Sudoku Cheat Backtracking Algorithm to Solve All Permutation/Combination/Subset Problems Some Questions About Backtracking and DFS Algorithms Solve All Island Problems with DFS Minesweeper Game II Ball and Box: Two Perspectives of Backtracking Enumeration Backtracking Algorithm Practice: Generating Valid Parentheses Backtracking Algorithm Practice: Partitioning k Subsets Exercise: Backtracking Problems on LeetCode I Exercise: Backtracking Problems on LeetCode II Exercise: Backtracking Problems on LeetCode III
BFS Algorithm
Chapter 3. Dynamic Programming Algorithms
Basic DP Techniques
Dynamic Programming Common Patterns and Code Template How to Design Transition Equations How to Determine the Base Case and Initial Values for Memoization? Two Perspectives of Dynamic Programming Enumeration How to Convert Backtracking to Dynamic Programming Optimize Space Complexity for Dynamic Programming Clarifying Some Questions About Dynamic Programming
Subsequence Problems
Knapsack Problems
Dynamic Programming Game
Classic DP: Minimum Path Sum Play Dungeon Game with DP Play Freedom Trail with DP Save Money on Your Trip: Weighted Shortest Path Multi-source shortest path: Floyd algorithm Classic DP: Regular Expression Matching Classic DP: Egg Drop Classic DP: Burst Balloons Classic DP: Game Theory One Method to Solve All House Robber Problems on LeetCode One Method to Solve all Stock Problems on LeetCode
Dynamic Programming ProblemSet
Greedy
Chapter 4. Other Common Techniques
Mathematical Techniques
LeetCode Problems with One Line Solution Common Bit Manipulation Techniques Essential Math Techniques Minesweeper Game I Random Algorithms in Games Two Classic Factorial Problems on LeetCode How to Efficiently Count Prime Numbers How to Find Missing and Duplicate Elements Interesting Probability Problems Exercise: Math Tricks
Classic Interview Problems
How to Efficiently Solve the Trapping Rain Water Problem One Article to Solve All Ugly Number Problems on LeetCode One Method to Solve Three Interval Problems on LeetCode Split Array into Consecutive Subsequences Pancake Sorting Algorithm String Multiplication Calculation How to Determine if a Rectangle is Perfect
More Topics
Computer Science
Frontend Development Introduction for AI Era Introduction to Modern Encryption Understand Session and Cookie Understanding JSON Web Token (JWT) Authentication vs. Authorization Understanding OAuth 2.0 Authorization Framework OAuth 2.0 and OIDC Authentication OAuth 2.0 and PKCE Understanding Single Sign-On (SSO) Certificate and CA TLS Key Exchange Mutual TLS Authentication Introduction to Linux File System Linux Shell Tips LSM Tree in Storage System - Updating
Design Pattern
How to Read
If you are preparing for interviews, follow the order in the Quick Mastery Learning Plan.
If you have plenty of time (for example, you are still in school), you can just follow the site directory and study step by step.
This site works well on both PC and mobile. You can get all you need for algorithm interviews and coding tests in one place:

What’s on This Site
The site includes tutorials and video explanations, mainly in three parts:
1️⃣ Data Structure Tutorials (about 10% of the content)
Mostly in Data Structures and Sorting Explained. This part covers sorting algorithms and core data structure concepts and code implementation. No algorithm problems here. The goal is to help you understand how common data structures work, so you can use them right away when solving problems in the future.
2️⃣ Algorithm Frameworks Explained With Examples (about 50%)
Some famous algorithm frameworks and typical problems are explained step by step with sample problems. Usually, one article covers 2–5 examples, so you can practice as you read.
3️⃣ Practice Problems for Frameworks (about 40%)
Chapters labeled Exercise are exercise parts, usually right after the framework content. All these problems can be solved using the frameworks. Doing many exercises will help you build muscle memory and master certain types of problems. Each practice session has 5–10 exercises, and once you know the framework, they are quick to solve.
This site helps you solve hundreds of public LeetCode problems. Most problems are for practicing these frameworks, and will be easy to solve in minutes after learning.
LeetCode Problem List
By request, I created a problem list that covers all problems on this site. After installing the Chrome Extension, you can see the site’s solution notes for every problem on this list.
Note: I don't think this problem list is very important, so I don’t suggest using it directly. The list is in a random order, so you won’t learn step by step or by topic. Also, you don’t need to do every problem. Once you’ve learned the frameworks here, most questions can be solved quickly, so you don’t need to force yourself to do every one.
| LeetCode CN | LeetCode |
|---|---|
| https://leetcode.cn/problem-list/59jEaTgw/ | https://leetcode.com/list/9zwo3ww5/ |
It is better to follow the Beginner Learning Plan or Quick Mastery Learning Plan, which have structured lists. The VSCode extension and Jetbrains extension also have these plans built in — for your convenience.

I care about your learning experience. The content here is always being updated and improved. You can find update logs and bug feedback links at the top.
About the Author
I’m labuladong, the author of the fucking-algorithm repo. Readers call me “Dong Ge”. I created the framework way of thinking about algorithms. My repo has been at the top of GitHub Trending many times and now has 125k stars.
My focus is quality over quantity. This site only focuses on helping you master coding problems for interviews and contests, efficiently and quickly.
Site subscription is the only paid feature. Pay one meal’s worth to unlock all content and tools, and enjoy smooth, easy learning.
Useful Features of This Site
Quick Mastery Roadmap
This site offers an Algorithm Quick Mastery Plan with a learning roadmap. You can click each node to see related articles and problem lists, making it easy to track your learning progress.
Algorithm Quick Mastery Roadmap
Algorithm Visualization
Every solution code on this site and all related plugins comes with an algorithm visualization panel. You can see how the algorithm runs, which helps you understand the logic.
For example, in the algorithm Finding the Start of the Cycle in a Singly Linked List, you can click the code if (fast == slow) break to see how the fast and slow pointers meet. Then, click while (slow != fast) to see how both pointers move together to the start of the cycle.
Example 1: Color System and Interaction
The visual panel also helps with complex data structures and recursive algorithms. Below is an example of a DFS on a graph to find all paths from node 0 to node 4. You can click if (s === n - 1) to see both the graph traversal and how the recursion tree grows.
Example 2: Complex Structures and Recursion
The visualization panel shows data structures in different ways to help you understand.
Below is a bar chart that shows the array in Insertion Sort. Click if (nums[i] < nums[i - 1]) to see the sorting steps.
Example 3: Sorting Algorithms
The visualization panel makes it much easier to understand complex algorithms. It supports all data structures and algorithms. Here are just a few examples. For more classic algorithm visualizations, see the Algorithm Visualization Quick Reference.
Learn by Playing Games
The visualization panels help you see how algorithms work, but only solving problems can get boring. I want to connect algorithms with real life to make them more fun and help you really enjoy learning algorithms.
One idea is to combine algorithms with games. Usually, we control games by hand, but what if you could use algorithms to control a game?
So, I designed some classic mini-games. In each game, the algorithm part is separated out. You'll get a game scene, and you write the algorithm to let the game engine run. You can make the game work, or finish some tasks that are hard by hand.
This way, you get a great sense of achievement. More importantly, you learn how algorithms are used in real situations, and your understanding will be deeper.
For example, here is a Snake game. You can write code for the snake’s movement and eating food. It might look hard, but it’s easy if you use basic singly linked list operations:
For more fun mini-games, see Algorithm Game List and Introduction.
Supports All Mainstream Programming Languages
All solution code on this site and all plugins support Java, C++, Python, Golang, JavaScript, and other common languages. This makes it easier for everyone.
All code in all languages has been tested and checked by me to make sure it is correct and consistent.
The site and plugins also support code image annotations. For complex code, there will be a small light bulb icon. Move your mouse over it to see the image for extra help:
class Solution {
public ListNode detectCycle(ListNode head) {
ListNode fast, slow;
fast = slow = head;
while (fast != null && fast.next != null) {
fast = fast.next.next;
slow = slow.next;
if (fast == slow) break;
}
// the above code is similar to the hasCycle function
if (fast == null || fast.next == null) {
// fast encountering a null pointer means there is no cycle
return null;
}
// reassign to the head node
slow = head;
// move fast and slow pointers at the same pace, the
// intersection point is the cycle's entry point
while (slow != fast) {
fast = fast.next;
slow = slow.next;
}
return slow;
}
}class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode *fast, *slow;
fast = slow = head;
while (fast != nullptr && fast->next != nullptr) {
fast = fast->next->next;
slow = slow->next;
if (fast == slow) break;
}
// the above code is similar to the hasCycle function
if (fast == nullptr || fast->next == nullptr) {
// if fast encounters a null pointer, it means there is no cycle
return nullptr;
}
// reset to the head node
slow = head;
// move the fast and slow pointers forward in sync, the
// intersection point is the start of the cycle
while (slow != fast) {
fast = fast->next;
slow = slow->next;
}
return slow;
}
};class Solution:
def detectCycle(self, head: ListNode):
fast, slow = head, head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
if fast == slow:
break
# the above code is similar to the hasCycle function
if not fast or not fast.next:
# if fast encounters a null pointer, it means there is no cycle
return None
# reset the pointer to the head node
slow = head
# both fast and slow pointers move forward in sync, the
# intersection point is the start of the cycle
while slow != fast:
fast = fast.next
slow = slow.next
return slowfunc detectCycle(head *ListNode) *ListNode {
fast, slow := head, head
for fast != nil && fast.Next != nil {
fast = fast.Next.Next
slow = slow.Next
if fast == slow {
break
}
}
// the above code is similar to the hasCycle function
if fast == nil || fast.Next == nil {
// if fast encounters a null pointer, it means there is no cycle
return nil
}
// reset the pointer to the head node
slow = head
// move the fast and slow pointers forward in sync,
// the intersection point is the start of the cycle
for slow != fast {
fast = fast.Next
slow = slow.Next
}
return slow
}var detectCycle = function(head) {
let fast, slow;
fast = slow = head;
while (fast !== null && fast.next !== null) {
fast = fast.next.next;
slow = slow.next;
if (fast == slow) break;
}
// the above code is similar to the hasCycle function
if (fast === null || fast.next === null) {
// if fast encounters a null pointer, it means there is no cycle
return null;
}
// reset the pointer to the head node
slow = head;
// move the fast and slow pointers forward in sync,
// the intersection point is the start of the cycle
while (slow !== fast) {
fast = fast.next;
slow = slow.next;
}
return slow;
};Other Useful Features
Reading History Supported. In the sidebar and in every article, articles you have not read show the
Focus Mode Supported. On computer, there is a "Focus Mode" switch at the top right of the page. Turn it on to blur the sidebar and top bar, making it easier to focus or to study at work.
Full Site Search Supported. The search box at the top right lets you search the whole site. You can even search by problems, numbers, or LeetCode links to find explanations.
Coding Practice Plugins for Learning
To meet everyone’s needs, I maintain plugins so you can practice coding in your favorite editor.
The plugins include the Beginner Directory and Quick Mastery Directory. You can debug code locally and easily view ideas, visual panels, and code image notes from this site.
You don't have to install the plugins, but I suggest installing the Chrome browser plugin. When you read articles here, you may visit LeetCode. The Chrome plugin gives you some extra tools. The vscode/Jetbrain plugins can also be installed if you like.
To see the install guides, check Chrome Plugin, vscode Plugin, Jetbrain Plugin.