说明

此列表目的仅为方便个人记录刷题情况和笔记,原作者为Cspiration创始人Edward Shi。你可以点击表格里的讲解链接找到他。

Array

题号 题目链接 讲解链接 说明
基础
27 Remove Element 视频讲解 https://blog.nowcoder.net/n/92277abac5134dc4abfdffeb884ad2ac
26 Remove Duplicates from Sorted Array 视频讲解 https://blog.nowcoder.net/n/8b7e3cbffba2437eae987ed8bf9996ce
80 Remove Duplicates from Sorted Array II 视频讲解 https://blog.nowcoder.net/n/bd24dfab20f545df877566ea69430d8b
277 Find the Celebrity 视频讲解 LeetCode会员可见
189 Rotate Array 视频讲解 https://blog.nowcoder.net/n/f55c5c6c090f4fd1bfdad71fc6146cf8
41 First Missing Positive 视频讲解 https://blog.nowcoder.net/n/c8c5f3a2fe994bc5b64aab7f761a5dab
299 Bulls and Cows 视频讲解 https://blog.nowcoder.net/n/456e946cde4741299cdc11f4224316b8
134 Gas Station 视频讲解 https://blog.nowcoder.net/n/b7e7788de44942939adaff06024e33bf
118 Pascal's Triangle 视频讲解 https://blog.nowcoder.net/n/9f3b350d18ac4107a9b9700f9be6beb5
119 Pascal's Triangle II 视频讲解 https://blog.nowcoder.net/n/c62c2516cf0b4695892ab3545f477033
169 Majority Element 视频讲解 https://blog.nowcoder.net/n/2bd5e876f9214e55a6a2a623274658ea
229 Majority Element II 视频讲解 https://blog.nowcoder.net/n/415006ffc294438e92640fc3e08018fb
274 H-Index 视频讲解 https://blog.nowcoder.net/n/53f80c9616044d7bbaf4dd876ee55d6a
275 H-Index II 视频讲解 https://blog.nowcoder.net/n/cfc7d9a820aa435998950e1de5005f54
243 Shortest Word Distance 视频讲解 LeetCode会员可见
244 Shortest Word Distance II 视频讲解 LeetCode会员可见
245 Shortest Word Distance III 视频讲解 LeetCode会员可见
217 Contains Duplicate 视频讲解 https://blog.nowcoder.net/n/a23f12c303d646d9852d9d60f333292a
219 Contains Duplicate II 视频讲解 https://blog.nowcoder.net/n/f69968286f244e59b3e45c935d5da6c8
220 Contains Duplicate III 视频讲解 https://blog.nowcoder.net/n/a23f12c303d646d9852d9d60f333292a
55 Jump Game 视频讲解 https://blog.nowcoder.net/n/b477057c40064610a41b36ade9403488
45 Jump Game II 视频讲解 https://blog.nowcoder.net/n/0e58bc3d0721473f983eaf5e0946fcc1
121 Best Time to Buy and Sell Stock 视频讲解 https://blog.nowcoder.net/n/33804b3cbc1841e9b0eed972b18a587c
122 Best Time to Buy and Sell Stock II 视频讲解 https://blog.nowcoder.net/n/ed7adf757ea940dfa8b18ada8dbfb3d4
123 Best Time to Buy and Sell Stock III 视频讲解 https://blog.nowcoder.net/n/80c125e813f94b50834da51f44e57d5e
188 Best Time to Buy and Sell Stock IV 视频讲解 https://blog.nowcoder.net/n/68ba92925f9f430880c2669f9ab1a244
309 Best Time to Buy and Sell Stock with Cooldown 视频讲解 https://blog.nowcoder.net/n/e175baed71fc443c8d9ec96c0420f57e
11 Container With Most Water 视频讲解 https://blog.nowcoder.net/n/06f0b0a091e549cf838515958eb1e132
42 Trapping Rain Water 视频讲解 https://blog.nowcoder.net/n/154e9b29c5aa4cbeb2d75a2a64fbc781
334 Increasing Triplet Subsequence 视频讲解 https://blog.nowcoder.net/n/44578029e60049428f76d7dd5f3520f0
128 Longest Consecutive Sequence 视频讲解 https://blog.nowcoder.net/n/1c6048e453e54329bdbcd749bac81a7b
164 Maximum Gap 视频讲解 Bucket
287 Find the Duplicate Number 视频讲解 https://blog.nowcoder.net/n/15bfb1eabb8f4ed384d660f681e8e73d
135 Candy 视频讲解 很少考
330 Patching Array 视频讲解 很少考
提高
4 Median of Two Sorted Arrays 视频讲解 很少考
321 Create Maximum Number 视频讲解 很少考
327 Count of Range Sum 视频讲解
289 Game of Life 视频讲解
Interval
57 Insert Interval 视频讲解
56 Merge Intervals 视频讲解
252 Meeting Rooms 视频讲解
253 Meeting Rooms II 视频讲解
352 Data Stream as Disjoint Intervals 视频讲解 TreeMap
Counter
239 Sliding Window Maximum 视频讲解
295 Find Median from Data Stream 视频讲解
53 Maximum Subarray 视频讲解
325 Maximum Size Subarray Sum Equals k 视频讲解
209 Minimum Size Subarray Sum 视频讲解
238 Product of Array Except Self 视频讲解
152 Maximum Product Subarray 视频讲解
228 Summary Ranges 视频讲解
163 Missing Ranges 视频讲解
Counter
88 Merge Sorted Array 视频讲解
75 Sort Colors 视频讲解
283 Move Zeroes 视频讲解
376 Wiggle Subsequence 视频讲解
280 Wiggle Sort 视频讲解
324 Wiggle Sort II 视频讲解
278 First Bad Version 视频讲解
35 Search Insert Position 视频讲解
33 Search in Rotated Sorted Array 视频讲解
81 Search in Rotated Sorted Array II 视频讲解
153 Find Minimum in Rotated Sorted Array 视频讲解
154 Find Minimum in Rotated Sorted Array II 视频讲解
162 Find Peak Element 视频讲解
374 Guess Number Higher or Lower 视频讲解
34 Find First and Last Position of Element in Sorted Array 视频讲解
349 Intersection of Two Arrays 视频讲解
350 Intersection of Two Arrays II 视频讲解
315 Count of Smaller Numbers After Self 视频讲解
300 Longest Increasing Subsequence 视频讲解
354 Russian Doll Envelopes 视频讲解

String

题号 题目链接 讲解链接 说明
基础
28 Implement strStr() 视频讲解
14 Longest Common Prefix 视频讲解
58 Length of Last Word 视频讲解
387 First Unique Character in a String 视频讲解
383 Ransom Note 视频讲解
344 Reverse String 视频讲解
151 Reverse Words in a String 视频讲解
186 Reverse Words in a String II 视频讲解
345 Reverse Vowels of a String 视频讲解
205 Isomorphic Strings 视频讲解
293 Flip Game 视频讲解
294 Flip Game II 视频讲解
290 Word Pattern 视频讲解
242 Valid Anagram 视频讲解
49 Group Anagrams 视频讲解
249 Group Shifted Strings 视频讲解
87 Scramble String 视频讲解
179 Largest Number 视频讲解 很少考
6 ZigZag Conversion 视频讲解 很少考
161 One Edit Distance 视频讲解
38 Count and Say 视频讲解
358 Rearrange String k Distance Apart 视频讲解
316 Remove Duplicate Letters 视频讲解
271 Encode and Decode Strings 视频讲解
168 Excel Sheet Column Title 视频讲解
171 Excel Sheet Column Number 视频讲解
13 Roman to Integer 视频讲解
12 Integer to Roman 视频讲解
273 Integer to English Words 视频讲解
246 Strobogrammatic Number 视频讲解
247 Strobogrammatic Number II 视频讲解
248 Strobogrammatic Number III 视频讲解 很少考
提高
157 Read N Characters Given Read4 视频讲解
158 Read N Characters Given Read4 II - Call multiple times 视频讲解
68 Text Justification 视频讲解
65 Valid Number 视频讲解
Substring
76 Minimum Window Substring 视频讲解 Sliding Window
30 Substring with Concatenation of All Words 视频讲解 Sliding Window
3 Longest Substring Without Repeating Characters 视频讲解 Sliding Window
340 Longest Substring with At Most K Distinct Characters 视频讲解 Sliding Window
395 Longest Substring with At Least K Repeating Characters 视频讲解 Sliding Window
159 Longest Substring with At Most Two Distinct Characters 视频讲解 Sliding Window
Palindrome
125 Valid Palindrome 视频讲解
266 Palindrome Permutation 视频讲解
5 Longest Palindromic Substring 视频讲解
9 Palindrome Number 视频讲解
214 Shortest Palindrome 视频讲解
336 Palindrome Pairs 视频讲解
131 Palindrome Partitioning 视频讲解
132 Palindrome Partitioning II 视频讲解
267 Palindrome Permutation II 视频讲解
Parentheses
20 Valid Parentheses 视频讲解
22 Generate Parentheses 视频讲解
32 Longest Valid Parentheses 视频讲解
241 Different Ways to Add Parentheses 视频讲解
301 Remove Invalid Parentheses 视频讲解
Subsequence
392 Is Subsequence 视频讲解
115 Distinct Subsequences 视频讲解
187 Repeated DNA Sequences 视频讲解 很少考

Math

题号 题目链接 讲解链接 说明
基础
7 Reverse Integer 视频讲解
165 Compare Version Numbers 视频讲解
66 Plus One 视频讲解
8 String to Integer (atoi) 视频讲解
258 Add Digits 视频讲解
67 Add Binary 视频讲解
43 Multiply Strings 视频讲解
29 Divide Two Integers 视频讲解
69 Sqrt(x) 视频讲解
50 Pow(x, n) 视频讲解
367 Valid Perfect Square 视频讲解
365 Water and Jug Problem 视频讲解
204 Count Primes 视频讲解
Sum
1 Two Sum 视频讲解
167 Two Sum II - Input array is sorted 视频讲解
15 3Sum 视频讲解
16 3Sum Closest 视频讲解 很少考
259 3Sum Smaller 视频讲解 很少考
18 4Sum 视频讲解
很少考
231 Power of Two 视频讲解
326 Power of Three 视频讲解
342 Power of Four 视频讲解
372 Super Pow 视频讲解
233 Number of Digit One 视频讲解
319 Bulb Switcher 视频讲解
292 Nim Game 视频讲解
202 Happy Number 视频讲解
400 Nth Digit 视频讲解
263 Ugly Number 视频讲解
264 Ugly Number II 视频讲解
306 Additive Number 视频讲解
172 Factorial Trailing Zeroes 视频讲解
343 Integer Break 视频讲解
396 Rotate Function 视频讲解
390 Elimination Game 视频讲解
386 Lexicographical Numbers 视频讲解
357 Count Numbers with Unique Digits 视频讲解
360 Sort Transformed Array 视频讲解
397 Integer Replacement 视频讲解
368 Largest Divisible Subset 视频讲解

Tree

题号 题目链接 讲解链接 说明
基础
144 Binary Tree Preorder Traversal 视频讲解
94 Binary Tree Inorder Traversal 视频讲解
145 Binary Tree Postorder Traversal 视频讲解
102 Binary Tree Level Order Traversal 视频讲解
Preorder
100 Same Tree 视频讲解
101 Symmetric Tree 视频讲解
226 Invert Binary Tree 视频讲解 preorder + BFS
257 Binary Tree Paths 视频讲解
112 Path Sum 视频讲解
113 Path Sum II 视频讲解
129 Sum Root to Leaf Numbers 视频讲解
298 Binary Tree Longest Consecutive Sequence 视频讲解
111 Minimum Depth of Binary Tree 视频讲解
Preorder
104 Maximum Depth of Binary Tree 视频讲解
110 Balanced Binary Tree 视频讲解
124 Binary Tree Maximum Path Sum 视频讲解
250 Count Univalue Subtrees 视频讲解
366 Find Leaves of Binary Tree 视频讲解
337 House Robber III 视频讲解 postorder + preorder
BFS
107 Binary Tree Level Order Traversal II 视频讲解
103 Binary Tree Zigzag Level Order Traversal 视频讲解
199 Binary Tree Right Side View 视频讲解 BFS + preorder
BST
98 Validate Binary Search Tree 视频讲解 preorder
235 Lowest Common Ancestor of a Binary Search Tree 视频讲解 preorder
236 Lowest Common Ancestor of a Binary Tree 视频讲解 postorder
108 Convert Sorted Array to Binary Search Tree 视频讲解 binary search
109 Convert Sorted List to Binary Search Tree 视频讲解 binary search
173 Binary Search Tree Iterator 视频讲解 inorder
230 Kth Smallest Element in a BST 视频讲解 inorder
297 Serialize and Deserialize Binary Tree 视频讲解 BFS
285 Inorder Successor in BST 视频讲解 inorder
270 Closest Binary Search Tree Value 视频讲解 preorder
272 Closest Binary Search Tree Value II 视频讲解 inorder
99 Recover Binary Search Tree 视频讲解 inorder
重要程度
156 Binary Tree Upside Down 视频讲解 很少考
114 Flatten Binary Tree to Linked List 视频讲解 很少考
255 Verify Preorder Sequence in Binary Search Tree 视频讲解 很少考
333 Largest BST Subtree 视频讲解 很少考
222 Count Complete Tree Nodes 视频讲解 很少考
105 Construct Binary Tree from Preorder and Inorder Traversal 视频讲解 很少考
106 Construct Binary Tree from Inorder and Postorder Traversal 视频讲解 很少考
116 Populating Next Right Pointers in Each Node 视频讲解 重要
117 Populating Next Right Pointers in Each Node II 视频讲解 重要
314 Binary Tree Vertical Order Traversal 视频讲解 重要
96 Unique Binary Search Trees 视频讲解 重要
95 Unique Binary Search Trees II 视频讲解 很少考
331 Verify Preorder Serialization of a Binary Tree 视频讲解 很少考

Backtracking

题号 题目链接 讲解链接 说明
78 Subsets 视频讲解
90 Subsets II 视频讲解
77 Combinations 视频讲解
39 Combination Sum 视频讲解
40 Combination Sum II 视频讲解
216 Combination Sum III 视频讲解
377 Combination Sum IV 视频讲解 Dynamic Programming
254 Factor Combinations 视频讲解
46 Permutations 视频讲解
47 Permutations II 视频讲解
31 Next Permutation 视频讲解 String
60 Permutation Sequence 视频讲解 String
291 Word Pattern II 视频讲解
17 Letter Combinations of a Phone Number 视频讲解
320 Generalized Abbreviation 视频讲解
93 Restore IP Addresses 视频讲解 很少考
282 Expression Add Operators 视频讲解
140 Word Break II 视频讲解
351 Android Unlock Patterns 视频讲解

Dynamic Programming

题号 题目链接 讲解链接 说明
一维
70 Climbing Stairs 视频讲解
62 Unique Paths 视频讲解
63 Unique Paths II 视频讲解
120 Triangle 视频讲解 很少考
279 Perfect Squares 视频讲解
139 Word Break 视频讲解
375 Guess Number Higher or Lower II 视频讲解
312 Burst Balloons 视频讲解
322 Coin Change 视频讲解
二维
256 Paint House 视频讲解
265 Paint House II 视频讲解
64 Minimum Path Sum 视频讲解
72 Edit Distance 视频讲解
97 Interleaving String 视频讲解
174 Dungeon Game 视频讲解
221 Maximal Square 视频讲解
85 Maximal Rectangle 视频讲解
363 Max Sum of Rectangle No Larger Than K 视频讲解 TreeSet
化简
198 House Robber 视频讲解
213 House Robber II 视频讲解
276 Paint Fence 视频讲解
91 Decode Ways 视频讲解
10 Regular Expression Matching 视频讲解
44 Wildcard Matching 视频讲解

Linked List

题号 题目链接 讲解链接
基础
206 Reverse Linked List 视频讲解
141 Linked List Cycle 视频讲解
24 Swap Nodes in Pairs 视频讲解
328 Odd Even Linked List 视频讲解
92 Reverse Linked List II 视频讲解
237 Delete Node in a Linked List 视频讲解
19 Remove Nth Node From End of List 视频讲解
83 Remove Duplicates from Sorted List 视频讲解
203 Remove Linked List Elements 视频讲解
82 Remove Duplicates from Sorted List II 视频讲解
369 Plus One Linked List 视频讲解
2 Add Two Numbers 视频讲解
160 Intersection of Two Linked Lists 视频讲解
21 Merge Two Sorted Lists 视频讲解
提高
234 Palindrome Linked List 视频讲解
143 Reorder List 视频讲解
142 Linked List Cycle II 视频讲解
148 Sort List 视频讲解
25 Reverse Nodes in k-Group 视频讲解
61 Rotate List 视频讲解
86 Partition List 视频讲解
23 Merge k Sorted Lists 视频讲解
147 Insertion Sort List 视频讲解

Binary Search

题号 题目链接 讲解链接
278 First Bad Version 视频讲解
35 Search Insert Position 视频讲解
33 Search in Rotated Sorted Array 视频讲解
81 Search in Rotated Sorted Array II 视频讲解
153 Find Minimum in Rotated Sorted Array 视频讲解
154 Find Minimum in Rotated Sorted Array II 视频讲解
162 Find Peak Element 视频讲解
374 Guess Number Higher or Lower 视频讲解
34 Find First and Last Position of Element in Sorted Array 视频讲解
349 Intersection of Two Arrays 视频讲解
350 Intersection of Two Arrays II 视频讲解
315 Count of Smaller Numbers After Self 视频讲解
300 Longest Increasing Subsequence 视频讲解
354 Russian Doll Envelopes 视频讲解

Matrix

题号 题目链接 讲解链接
48 Rotate Image 视频讲解
54 Spiral Matrix 视频讲解
59 Spiral Matrix II 视频讲解
73 Set Matrix Zeroes 视频讲解
311 Sparse Matrix Multiplication 视频讲解
329 Longest Increasing Path in a Matrix 视频讲解
378 Kth Smallest Element in a Sorted Matrix 视频讲解
74 Search a 2D Matrix 视频讲解
240 Search a 2D Matrix II 视频讲解
370 Range Addition 视频讲解
79 Word Search 视频讲解
296 Best Meeting Point 视频讲解
361 Bomb Enemy 视频讲解
317 Shortest Distance from All Buildings 视频讲解
302 Smallest Rectangle Enclosing Black Pixels 视频讲解
36 Valid Sudoku 视频讲解
37 Sudoku Solver 视频讲解

DFS & BFS

题号 题目链接 讲解链接
200 Number of Islands 视频讲解
286 Walls and Gates 视频讲解
130 Surrounded Regions 视频讲解
339 Nested List Weight Sum 视频讲解
364 Nested List Weight Sum II 视频讲解
127 Word Ladder 视频讲解
51 N-Queens 视频讲解
52 N-Queens II 视频讲解
126 Word Ladder II 视频讲解

Stack & PriorityQueue

题号 题目链接 讲解链接 说明
Stack
155 Min Stack 视频讲解
232 Implement Queue using Stacks 视频讲解
225 Implement Stack using Queues 视频讲解
150 Evaluate Reverse Polish Notation 视频讲解
71 Simplify Path 视频讲解
388 Longest Absolute File Path 视频讲解
394 Decode String 视频讲解
224 Basic Calculator 视频讲解
227 Basic Calculator II 视频讲解
385 Mini Parser 视频讲解
84 Largest Rectangle in Histogram 视频讲解
PriorityQueue
215 Kth Largest Element in an Array 视频讲解
347 Top K Frequent Elements 视频讲解
313 Super Ugly Number 视频讲解 很少考
373 Find K Pairs with Smallest Sums 视频讲解 很少考
218 The Skyline Problem 视频讲解
332 Reconstruct Itinerary 视频讲解
341 Flatten Nested List Iterator 视频讲解

Bit Manipulation

题号 题目链接 讲解链接
389 Find the Difference 视频讲解
136 Single Number 视频讲解
318 Maximum Product of Word Lengths 视频讲解
很少考
393 UTF-8 Validation 视频讲解
201 Bitwise AND of Numbers Range 视频讲解
371 Sum of Two Integers emove Element 视频讲解
338 Counting Bits 视频讲解
89 Gray Code 视频讲解
268 Missing Number 视频讲解
191 Number of 1 Bits 视频讲解
190 Reverse Bits 视频讲解
137 Single Number II 视频讲解
260 Single Number III 视频讲解

Topology Sort

题号 题目链接 讲解链接
207 Course Schedule 视频讲解
210 Course Schedule II 视频讲解
269 Alien Dictionary 视频讲解

Random

题号 题目链接 讲解链接
384 Shuffle an Array 视频讲解
398 Random Pick Index 视频讲解
382 Linked List Random Node 视频讲解
380 Insert Delete GetRandom O(1) 视频讲解
381 Insert Delete GetRandom O(1) - Duplicates allowed 视频讲解
138 Copy List with Random Pointer 视频讲解

Graph

题号 题目链接 讲解链接 说明
基础
133 Clone Graph 视频讲解
399 Evaluate Division 视频讲解
310 Minimum Height Trees 视频讲解
图形学
149 Max Points on a Line 视频讲解
335 Self Crossing 视频讲解 很少考
356 Line Reflection 视频讲解 很少考
391 Perfect Rectangle 视频讲解 很少考
223 Rectangle Area 视频讲解 很少考

Union Find

题号 题目链接 讲解链接
261 Graph Valid Tree 视频讲解
323 Number of Connected Components in an Undirected Graph 视频讲解
305 Number of Islands II 视频讲解

Trie

题号 题目链接 讲解链接
211 Add and Search Word - Data structure design 视频讲解
208 Implement Trie (Prefix Tree) 视频讲解
212 Word Search II 视频讲解

Design

题号 题目链接 讲解链接 说明
359 Logger Rate Limiter 视频讲解
346 Moving Average from Data Stream 视频讲解 Sliding Window
362 Design Hit Counter 视频讲解
281 Zigzag Iterator 视频讲解
284 Peeking Iterator 视频讲解
251 Flatten 2D Vector 视频讲解
288 Unique Word Abbreviation 视频讲解
170 Two Sum III - Data structure design 视频讲解
348 Design Tic-Tac-Toe 视频讲解
379 Design Phone Directory 视频讲解
353 Design Snake Game 视频讲解
146 LRU Cache 视频讲解
355 Design Twitter 视频讲解
303 Range Sum Query - Immutable 视频讲解
304 Range Sum Query 2D - Immutable 视频讲解
307 Range Sum Query - Mutable 视频讲解 BIT & ST
308 Range Sum Query 2D - Mutable 视频讲解 BIT & ST