LeetCode All in One 题目讲解汇总(持续更新中...)

时间:2021-08-13 21:01:14

终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~

477 Total Hamming Distance 44.10% Meidum
475 Heaters  30.20% Easy
474 Ones and Zeroes  34.90% Meidum
473 Matchsticks to Square  31.80% Medium
472 Concatenated Words 29.20% Hard
471 Encode String with Shortest Length $ 43.50% Hard
469 Convex Polygon $ 27.20% Medium
468 Validate IP Address 22.10% Medium
467 Unique Substrings in Wraparound String 29.90% Medium
466 Count The Repetitions  24.20% Hard
465 Optimal Account Balancing $ 29.20% Hard
464 Can I Win  22.20% Medium
463 Island Perimeter  56.70% Easy
462 Minimum Moves to Equal Array Elements II 50.90% Medium
461 Hamming Distance  73.20% Easy
460 LFU Cache 18.30% Hard
459 Repeated Substring Pattern  39.70% Easy
456 132 Pattern  28.00% Medium
455 Assign Cookies 48.10% Easy
454 4Sum II 42.80% Medium
453 Minimum Moves to Equal Array Elements 46.30% Easy
452 Minimum Number of Arrows to Burst Balloons  42.10% Medium
451 Sort Characters By Frequency 50.90% Medium
450 Delete Node in a BST 34.50% Medium
449 Serialize and Deserialize BST  41.20% Medium
448 Find All Numbers Disappeared in an Array 58.30% Easy
447 Number of Boomerangs   42.20% Easy 
446 Arithmetic Slices II - Subsequence  22.30% Hard 
445 Add Two Numbers II   45.40% Medium
444 Sequence Reconstruction $ 20.50% Medium
442 Find All Duplicates in an Array 46.40% Medium
441 Arranging Coins 36.20% Easy 
440 K-th Smallest in Lexicographical Order  21.50% Hard 
439 Ternary Expression Parser $ 49.40% Medium
438 Find All Anagrams in a String  33.50% Easy 
437 Path Sum III   38.60% Easy
436 Find Right Interval  42.30% Medium
435 Non-overlapping Intervals  39.80% Medium
434 Number of Segments in a String   38.40% Easy 
432 All O`one Data Structure 28.30% Hard 
425 Word Squares 40.10% Hard
424 Longest Repeating Character Replacement 38.10% Medium
423 Reconstruct Original Digits from English 40.80% Medium
422 Valid Word Square $ 36.40% Easy
421 Maximum XOR of Two Numbers in an Array 36.40% Medium
420 Strong Password Checker  22.10% Hard
419 Battleships in a Board  59.30% Medium
418 Sentence Screen Fitting $ 25.10% Medium
417 Pacific Atlantic Water Flow 31.10% Medium
416 Partition Equal Subset Sum 36.80% Medium
415 Add Strings  41.50% Easy
414 Third Maximum Number   26.50% Easy
413 Arithmetic Slices 53.50% Medium
412 Fizz Buzz 57.50% Easy 
411 Minimum Unique Word Abbreviation $ 25.60% Hard
410 Split Array Largest Sum  25.00% Hard
409 Longest Palindrome  44.90% Easy
408 Valid Word Abbreviation $ 26.20% Easy
407 Trapping Rain Water II  33.10% Hard
406 Queue Reconstruction by Height 54.10% Medium
405 Convert a Number to Hexadecimal 41.80% Easy
404 Sum of Left Leaves  46.20% Easy
403 Frog Jump 31.70% Hard
402 Remove K Digits  25.90% Medium
401 Binary Watch  43.00% Easy
400 Nth Digit 30.70% Easy
399 Evaluate Division 34.60% Medium
398 Random Pick Index 30.40% Medium
397 Integer Replacement 25.90% Easy
396 Rotate Function  28.40% Easy
395 Longest Substring with At Least K Repeating Characters 32.50% Medium
394 Decode String 38.60% Medium
393 UTF-8 Validation  33.00% Medium
392 Is Subsequence   44.10% Medium
391 Perfect Rectangle 13.30% Hard 
390 Elimination Game 12.50%  Medium
389 Find the Difference 49.90% Easy 
388 Longest Absolute File Path  28.30%  Medium
387 First Unique Character in a String  43.10%  Easy 
386 Lexicographical Numbers 31.00%  Medium
385 Mini Parser  26.90%  Medium
384 Shuffle an Array  45.50%  Medium
383 Ransom Note 44.60%  Easy 
382 Linked List Random Node  48.60% Medium
381 Insert Delete GetRandom O(1) - Duplicates allowed 30.90% Hard
380 Insert Delete GetRandom O(1) 33.80% Medium
379 Design Phone Directory $  25.80%  Medium
378 Kth Smallest Element in a Sorted Matrix 40.20% Medium
377 Combination Sum IV  37.50% Medium
376 Wiggle Subsequence 35.80% Medium
375 Guess Number Higher or Lower II  28.30% Medium
374 Guess Number Higher or Lower  31.70% Easy
373 Find K Pairs with Smallest Sums  25.50% Medium
372 Super Pow 30.10% Medium
371 Sum of Two Integers  54.00% Easy
370 Range Addition $ 49.90% Medium
369 Plus One Linked List $ 50.10% Medium
368 Largest Divisible Subset  32.00% Medium
367 Valid Perfect Square  36.60% Medium
366 Find Leaves of Binary Tree $ 53.60% Medium
365 Water and Jug Problem  20.10% Medium
364 Nested List Weight Sum II $ 47.20% Medium
363 Max Sum of Rectangle No Larger Than K 27.00% Hard
362 Design Hit Counter $ 48.30% Medium
361 Bomb Enemy $ 32.60% Medium
360 Sort Transformed Array $ 40.80% Medium
359 Logger Rate Limiter $ 56.00% Easy
358 Rearrange String k Distance Apart $ 26.90% Hard
357 Count Numbers with Unique Digits  42.50% Medium
356 Line Reflection $ 28.70% Medium
355 Design Twitter 22.20% Medium
354 Russian Doll Envelopes  27.10% Hard
353 Design Snake Game $ 19.80% Medium
352 Data Stream as Disjoint Intervals  34.40% Hard
351 Android Unlock Patterns $ 32.00% Medium
350 Intersection of Two Arrays II 41.50% Easy
349 Intersection of Two Arrays 47.80%  Easy 
348 Design Tic-Tac-Toe  $ 45.60% Medium
347 Top K Frequent Elements  44.50% Medium
346 Moving Average from Data Stream  $ 69.20% Easy
345 Reverse Vowels of a String  35.30% Easy
344 Reverse String 58.90% Easy
343 Integer Break 43.60% Medium
342 Power of Four 34.10% Easy
341 Flatten Nested List Iterator $ 18.70% Medium
340 Longest Substring with At Most K Distinct Characters $ 36.30% Hard
339 Nested List Weight Sum $ 54.60% Easy
338 Counting Bits  55.40% Medium
337 House Robber III  37.00% Medium
336 Palindrome Pairs  18.70% Hard
335 Self Crossing  18.00% Medium
334 Increasing Triplet Subsequence 33.20% Medium
333 Largest BST Subtree $ 26.50% Medium
332 Reconstruct Itinerary 23.40% Medium
331 Verify Preorder Serialization of a Binary Tree 31.50% Medium
330 Patching Array 28.80% Medium
329 Longest Increasing Path in a Matrix 29.50% Medium
328 Odd Even Linked List 37.80% Easy
327 Count of Range Sum 24.30% Hard
326 Power of Three 35.30% Easy
325 Maximum Size Subarray Sum Equals k $ 39.60% Easy
324 Wiggle Sort II 20.10% Medium
323 Number of Connected Components in an Undirected Graph $ 43.30% Medium
322 Coin Change 24.90% Medium
321 Create Maximum Number 19.10% Hard
320 Generalized Abbreviation $ 40.40% Medium
319 Bulb Switcher 39.20% Medium
318 Maximum Product of Word Lengths 38.70% Medium
317 Shortest Distance from All Buildings $ 29.10% Hard 
316 Remove Duplicate Letters 23.00% Medium
315 Count of Smaller Numbers After Self 28.20% Hard 
314 Binary Tree Vertical Order Traversal $ 30.10% Medium
313 Super Ugly Number 31.20% Medium
312 Burst Balloons 24.50% Medium
311 Sparse Matrix Multiplication $ 40.00% Medium
310 Minimum Height Trees  20.20% Medium
309 Best Time to Buy and Sell Stock with Cooldown  32.60% Medium
308 Range Sum Query 2D - Mutable $ 20.30% Hard
307 Range Sum Query - Mutable  14.50% Medium
306 Additive Number 23.30% Medium
305 Number of Islands II $ 26.70% Hard
304 Range Sum Query 2D - Immutable 21.50% Medium
303 Range Sum Query - Immutable 25.70% Easy
302 Smallest Rectangle Enclosing Black Pixels $ 36.70% Hard
301 Remove Invalid Parentheses 27.00% Hard
300 Longest Increasing Subsequence 31.50% Medium
299 Bulls and Cows 23.80% Easy
298 Binary Tree Longest Consecutive Sequence $ 32.20% Medium
297 Serialize and Deserialize Binary Tree 23.80% Medium
296 Best Meeting Point $ 41.40% Hard
295 Find Median from Data Stream 18.60% Hard
294 Flip Game II $ 38.10% Medium
293 Flip Game $ 47.60% Easy
292 Nim Game  49.50% Easy
291 Word Pattern II $ 31.50% Hard
290 Word Pattern 26.50% Easy
289 Game of Life 32.60% Medium
288 Unique Word Abbreviation $ 16.80% Easy
287 Find the Duplicate Number 32.80% Hard
286 Walls and Gates $ 29.90% Medium
285 Inorder Successor in BST $ 32.50% Medium
284 Peeking Iterator 31.00% Medium
283 Move Zeroes 41.40% Easy
282 Expression Add Operators 18.90% Hard
281 Zigzag Iterator $ 37.20% Medium
280 Wiggle Sort $ 43.30% Medium
279 Perfect Squares 28.80% Medium
278 First Bad Version 19.80% Easy
277 Find the Celebrity $ 31.70% Medium
276 Paint Fence $ 25.00% Easy
275 H-Index II 31.40% Medium
274 H-Index 25.30% Medium
273 Integer to English Words 15.50% Medium
272 Closest Binary Search Tree Value II $ 26.90% Hard
271 Encode and Decode Strings $ 25.40% Medium
270 Closest Binary Search Tree Value $ 29.40% Easy
269 Alien Dictionary $ 16.50% Hard
268 Missing Number 34.70% Medium
267 Palindrome Permutation II $ 22.50% Medium
266 Palindrome Permutation $ 45.80% Easy
265 Paint House II $ 30.00% Hard
264 Ugly Number II 21.60% Medium
263 Ugly Number 32.6% Easy
262 Trips and Users * 16.10% Hard
261 Graph Valid Tree $ 25.40% Medium
260 Single Number III 37.60% Medium
259 3Sum Smaller $ 34.20% Medium
258 Add Digits 46.50% Easy
257 Binary Tree Paths 21.90% Easy
256 Paint House $ 38.40% Medium
255 Verify Preorder Sequence in Binary Search Tree $ 32.30% Medium
254 Factor Combinations $ 29.00% Medium
253 Meeting Rooms II $ 28.80% Medium
252 Meeting Rooms $ 35.40% Easy
251 Flatten 2D Vector $ 28.30% Medium
250 Count Univalue Subtrees $ 32.70% Medium
249 Group Shifted Strings $ 25.20% Easy
248 Strobogrammatic Number III $ 21.80% Hard
247 Strobogrammatic Number II $ 26.70% Medium
246 Strobogrammatic Number $ 31.60% Easy
245 Shortest Word Distance III $ 43.20% Medium
244 Shortest Word Distance II $ 33.70% Medium
243 Shortest Word Distance $ 41.80% Easy
242 Valid Anagram 39.30% Easy
241 Different Ways to Add Parentheses 27.10% Medium
240 Search a 2D Matrix II 31.40% Medium
239 Sliding Window Maximum 24.30% Hard 
238 Product of Array Except Self 42.40% Medium
237 Delete Node in a Linked List 50.90% Easy
236 Lowest Common Ancestor of a Binary Tree 28.30% Medium
235 Lowest Common Ancestor of a Binary Search Tree 38.90% Medium
234 Palindrome Linked List 23.80% Easy
233 Number of Digit One 16.10% Medium
232 Implement Queue using Stacks 37.40% Easy
231 Power of Two 31.30% Easy
230 Kth Smallest Element in a BST 30.50% Medium
229 Majority Element II 30.50% Medium
228 Summary Ranges 21.10% Easy
227 Basic Calculator II 18.00% Medium
226 Invert Binary Tree 35.40% Easy
225 Implement Stack using Queues 29.60% Medium
224 Basic Calculator 15.80% Medium
223 Rectangle Area 25.60% Easy
222 Count Complete Tree Nodes 19.40% Medium
221 Maximal Square 20.30% Medium
220 Contains Duplicate III 15.30% Medium
219 Contains Duplicate II 25.60% Easy
218 The Skyline Problem 16.20% Hard
217 Contains Duplicate 35.90% Easy
216 Combination Sum III 27.70% Medium
215 Kth Largest Element in an Array 27.30% Medium
214 Shortest Palindrome 16.80% Hard
213 House Robber II 26.30% Medium
212 Word Search II 15.00% Hard
211 Add and Search Word - Data structure design 20.70% Medium
210 Course Schedule II 19.30% Medium
209 Minimum Size Subarray Sum 22.90% Medium
208 Implement Trie (Prefix Tree) 24.80% Medium
207 Course Schedule 21.70% Medium
206 Reverse Linked List 31.50% Easy
205 Isomorphic Strings 24.20% Easy
204 Count Primes 19.00% Easy
203 Remove Linked List Elements 25.80% Easy
202 Happy Number 31.40% Easy
201 Bitwise AND of Numbers Range 23.30% Medium
200 Number of Islands 21.90% Medium
199 Binary Tree Right Side View 27.10% Medium
198 House Robber 28.80% Easy
197 Rising Temperature * 25.90% Easy
196 Delete Duplicate Emails * 19.00% Easy
195 Tenth Line # 32.20% Easy
194 Transpose File # 21.40% Medium
193 Valid Phone Numbers # 24.40% Easy
192 Word Frequency # 26.10% Medium
191 Number of 1 Bits 37.30% Easy
190 Reverse Bits 28.40% Easy
189 Rotate Array 17.80% Easy
188 Best Time to Buy and Sell Stock IV 17.30% Hard
187 Repeated DNA Sequences 19.50% Medium
186 Reverse Words in a String II $ 31.10% Medium
185 Department Top Three Salaries * 15.20% Hard
184 Department Highest Salary * 19.00% Medium
183 Customers Who Never Order * 33.70% Easy
182 Duplicate Emails * 38.10% Easy
181 Employees Earning More Than Their Managers * 41.00% Easy
180 Consecutive Numbers * 26.60% Medium
179 Largest Number 15.70% Medium
178 Rank Scores * 24.60% Medium
177 Nth Highest Salary * 16.30% Medium
176 Second Highest Salary * 25.00% Easy
175 Combine Two Tables * 34.40% Easy
174 Dungeon Game 17.70% Hard
173 Binary Search Tree Iterator 29.30% Medium
172 Factorial Trailing Zeroes 28.40% Easy
171 Excel Sheet Column Number 36.50% Easy
170 Two Sum III - Data structure design $ 24.70% Easy
169 Majority Element 35.00% Easy
168 Excel Sheet Column Title 18.10% Easy
167 Two Sum II - Input array is sorted $ 43.30% Medium
166 Fraction to Recurring Decimal 12.70% Medium
165 Compare Version Numbers 15.20% Easy
164 Maximum Gap 24.40% Hard
163 Missing Ranges $ 24.10% Medium
162 Find Peak Element 31.50% Medium
161 One Edit Distance $ 24.00% Medium
160 Intersection of Two Linked Lists 28.70% Easy
159 Longest Substring with At Most Two Distinct Characters $ 30.20% Hard
158 Read N Characters Given Read4 II - Call multiple times $ 22.30% Hard
157 Read N Characters Given Read4 $ 29.80% Easy
156 Binary Tree Upside Down $ 34.30% Medium
155 Min Stack 18.50% Easy
154 Find Minimum in Rotated Sorted Array II 31.90% Hard
153 Find Minimum in Rotated Sorted Array 33.30% Medium
152 Maximum Product Subarray 19.40% Medium
151 Reverse Words in a String 15.10% Medium
150 Evaluate Reverse Polish Notation 21.10% Medium
149 Max Points on a Line 12.60% Hard
148 Sort List 22.00% Medium
147 Insertion Sort List 26.40% Medium
146 LRU Cache 15.00% Hard
145 Binary Tree Postorder Traversal 32.40% Hard
144 Binary Tree Preorder Traversal 36.30% Medium
143 Reorder List 21.00% Medium
142 Linked List Cycle II 31.40% Medium
141 Linked List Cycle 36.30% Medium
140 Word Break II 17.70% Hard
139 Word Break 23.00% Medium
138 Copy List with Random Pointer 25.10% Hard
137 Single Number II 35.00% Medium
136 Single Number 45.10% Medium
135 Candy 20.50% Hard
134 Gas Station 25.70% Medium
133 Clone Graph 24.00% Medium
132 Palindrome Partitioning II 19.70% Hard
131 Palindrome Partitioning 26.70% Medium
130 Surrounded Regions 14.60% Medium
129 Sum Root to Leaf Numbers 30.30% Medium
128 Longest Consecutive Sequence 29.40% Hard
127 Word Ladder 19.30% Medium
126 Word Ladder II 12.90% Hard
125 Valid Palindrome 22.00% Easy
124 Binary Tree Maximum Path Sum 21.50% Hard
123 Best Time to Buy and Sell Stock III 23.90% Hard
122 Best Time to Buy and Sell Stock II 38.30% Medium
121 Best Time to Buy and Sell Stock 32.60% Medium
120 Triangle 27.40% Medium
119 Pascal's Triangle II 29.40% Easy
118 Pascal's Triangle 30.10% Easy
117 Populating Next Right Pointers in Each Node II 32.00% Hard
116 Populating Next Right Pointers in Each Node 36.20% Medium
115 Distinct Subsequences 26.30% Hard
114 Flatten Binary Tree to Linked List 28.80% Medium
113 Path Sum II 26.60% Medium
112 Path Sum 29.80% Easy
111 Minimum Depth of Binary Tree 29.10% Easy
110 Balanced Binary Tree 32.00% Easy
109 Convert Sorted List to Binary Search Tree 27.90% Medium
108 Convert Sorted Array to Binary Search Tree 34.00% Medium
107 Binary Tree Level Order Traversal II 31.10% Easy
106 Construct Binary Tree from Inorder and Postorder Traversal 26.80% Medium
105 Construct Binary Tree from Preorder and Inorder Traversal 26.40% Medium
104 Maximum Depth of Binary Tree 45.10% Easy
103 Binary Tree Zigzag Level Order Traversal 26.40% Medium
102 Binary Tree Level Order Traversal 29.30% Easy
101 Symmetric Tree 31.60% Easy
100 Same Tree 41.80% Easy
99 Recover Binary Search Tree 24.30% Hard
98 Validate Binary Search Tree 20.60% Medium
97 Interleaving String 20.80% Hard
96 Unique Binary Search Trees 36.00% Medium
95 Unique Binary Search Trees II 28.00% Medium
94 Binary Tree Inorder Traversal 36.20% Medium
93 Restore IP Addresses 21.00% Medium
92 Reverse Linked List II 26.10% Medium
91 Decode Ways 16.40% Medium
90 Subsets II 27.70% Medium
89 Gray Code 32.80% Medium
88 Merge Sorted Array 29.70% Easy
87 Scramble String 24.20% Hard
86 Partition List 27.50% Medium
85 Maximal Rectangle 22.00% Hard
84 Largest Rectangle in Histogram 22.60% Hard
83 Remove Duplicates from Sorted List 34.50% Easy
82 Remove Duplicates from Sorted List II 25.00% Medium
81 Search in Rotated Sorted Array II 31.40% Medium
80 Remove Duplicates from Sorted Array II 30.50% Medium
79 Word Search 20.30% Medium
78 Subsets 28.20% Medium
77 Combinations 30.90% Medium
76 Minimum Window Substring 18.90% Hard
75 Sort Colors 32.60% Medium
74 Search a 2D Matrix 31.60% Medium
73 Set Matrix Zeroes 31.40% Medium
72 Edit Distance 26.20% Hard
71 Simplify Path 20.00% Medium
70 Climbing Stairs 34.40% Easy
69 Sqrt(x) 23.10% Medium
68 Text Justification 14.60% Hard
67 Add Binary 24.70% Easy
66 Plus One 30.40% Easy
65 Valid Number 11.40% Hard
64 Minimum Path Sum 32.20% Medium
63 Unique Paths II 28.00% Medium
62 Unique Paths 32.80% Medium
61 Rotate List 21.70% Medium
60 Permutation Sequence 22.80% Medium
59 Spiral Matrix II 31.80% Medium
58 Length of Last Word 28.00% Easy
57 Insert Interval 21.40% Hard
56 Merge Intervals 22.40% Hard
55 Jump Game 27.00% Medium
54 Spiral Matrix 20.80% Medium
53 Maximum Subarray 34.50% Medium
52 N-Queens II 35.80% Hard
51 N-Queens 26.50% Hard
50 Pow(x, n) 26.70% Medium
49 Anagrams 24.30% Medium
48 Rotate Image 31.90% Medium
47 Permutations II 25.80% Hard
46 Permutations 31.90% Medium
45 Jump Game II 24.20% Hard
44 Wildcard Matching 15.00% Hard
43 Multiply Strings 21.00% Medium
42 Trapping Rain Water 30.00% Hard
41 First Missing Positive 22.90% Hard
40 Combination Sum II 25.20% Medium
39 Combination Sum 27.90% Medium
38 Count and Say 25.20% Easy
37 Sudoku Solver 21.80% Hard
36 Valid Sudoku 27.20% Easy
35 Search Insert Position 35.40% Medium
34 Search for a Range 27.50% Medium
33 Search in Rotated Sorted Array 28.80% Hard
32 Longest Valid Parentheses 20.90% Hard
31 Next Permutation 25.00% Medium
30 Substring with Concatenation of All Words 19.40% Hard
29 Divide Two Integers 15.00% Medium
28 Implement strStr() 22.20% Easy
27 Remove Element 32.10% Easy
26 Remove Duplicates from Sorted Array 31.30% Easy
25 Reverse Nodes in k-Group 25.50% Hard
24 Swap Nodes in Pairs 32.50% Medium
23 Merge k Sorted Lists 21.10% Hard
22 Generate Parentheses 32.60% Medium
21 Merge Two Sorted Lists 32.70% Easy
20 Valid Parentheses 26.50% Easy
19 Remove Nth Node From End of List 27.10% Easy
18 4Sum 21.70% Medium
17 Letter Combinations of a Phone Number 25.80% Medium
16 3Sum Closest 26.90% Medium
15 3Sum 16.90% Medium
14 Longest Common Prefix 25.50% Easy
13 Roman to Integer 34.00% Easy
12 Integer to Roman 33.80% Medium
11 Container With Most Water 32.00% Medium
10 Regular Expression Matching 20.70% Hard
9 Palindrome Number 28.30% Easy
8 String to Integer (atoi) 13.00% Easy
7 Reverse Integer 25.10% Easy
6 ZigZag Conversion 21.80% Easy
5 Longest Palindromic Substring 20.70% Medium
4 Median of Two Sorted Arrays 17.40% Hard
3 Longest Substring Without Repeating Characters 20.60% Medium
2 Add Two Numbers 21.10% Medium
1 Two Sum 17.70% Medium