LeetCode精华题目列表【刷题规划系列】 – TuringPlanet
目录
算法题到底在考察什么?
题目列表
Array
String
Linked List
Queue
Stack
Advanced Data Structures
HashSet / HashTable
Tree
Heap
Graph (Breadth-FS)
Graph (Best-FS)
Graph (DFS)
Basic Algorithms
Binary Search
Breadth-First Search
Best-First Search
Depth-First Search
Backtracking
Dynamic Programming 1D
Dynamic Programming 1D (Multiple States)
Dynamic Programming 2D (2D Input)
Dynamic Programming 2D (Two 1D Inputs)
Dynamic Programming 2D (1D Input)
Dynamic Programming 2D (1D Input + K)
Dynamic Programming (Knapsack)
Advanced Algorithms
Trie
Union Find
Topological Sort
Boyer-Moore Voting Algorithm
Complex Problems
HashTable + Doubly Linked List
算法题到底在考察什么?
算法题→系统性解决问题的能力
题目列表
Array
Classic Problems | Similar Problems |
189. Rotate Array | |
88. Merge Sorted Array | |
1260. Shift 2D Grid | |
941. Valid Mountain Array | |
283. Move Zeros | |
167. Two Sum II – Input array is sorted | |
167. Two Sum II – Input array is sorted | |
26. Remove Duplicates from Sorted Array | 80. Remove Duplicates from Sorted Array II |
56. Merge Intervals | |
11. Container With Most Water | |
31. Next Permuation | |
442. Find All Duplicates in an Array | |
48. Rotate Image | |
75. Sort Colors | |
57. Insert Interval | |
42. Trapping Rain Water | |
String
Classic Problems | Similar Problems |
551. Student Attendance Record I | | |
344. Reverse String | | |
937. Reorder Data in Log Files | | |
824. Goat Latin | | |
415. Add Strings | | |
14. Longest Common Prefix | | |
28. Implement strStr() | | |
6. ZigZag Conversion | | |
8. String to Integer (atoi) | | |
443. String Compression | | |
151. Reverse Words in a String | 186. Reverse Words in a String II | 557. Reverse Words in a String III |
809. Expressive Words | | |
616. Add Bold Tag in String | | |
848. Shifting Letters | | |
68. Text Justification | | |
1328. Break a Palindrome | | |
Linked List
Classic Problems | Similar Problems |
876. Middle of the Linked List | | | |
21. Merge Two Sorted Lists | | | |
237. Delete Node in a Linked List | | | |
206. Reverse Linked List | 92. Reverse Linked List II | 24. Swap Nodes in Pairs | 25. Reverse Nodes in k-Group |
234. Palindrome Linked List | | | |
83. Remove Duplicates from Sorted List | 82. Remove Duplicates from Sorted List II | | |
141. Linked List Cycle | 142. Linked List Cycle II | | |
2. Add Two Numbers | 445. Add Two Numbers II | | |
19. Remove Nth Node From End of List | | | |
708. Insert into a Sorted Circular Linked List | | | |
147. Insertion Sort List | | | |
725. Split Linked List in Parts | | | |
Queue
Stack
Classic Problems | Similar Problems |
22. Valid Parentheses | | | |
1249.Minimum Remove to Make Valid Parentheses | | | |
1021. Remove Outermost Parentheses | | | |
232. Implement Queue using Stacks | | | |
682. Baseball Game | | | |
155. Min Stack | | | |
496. Next Greater Element I | 503. Next Greater Element II | 739. Daily Temperatures | 1019. Next Greater Node In Linked List |
1249. Minimum Remove to Make Valid Parentheses | | | |
173. Binary Search Tree Iterator | | | |
636. Exclusive Time of Functions | | | |
394. Decode String | 224. Basic Calculator | | |
71. Simplify Path | | | |
735. Asteroid Collision | | | |
150. Evaluate Reverse Polish Notation | | | |
32. Longest Valid Parentheses | | | |
84. Largest Rectangle in Histogram | 85. Maximal Rectangle | | |
895. Maximum Frequency Stack | | | |
Advanced Data Structures
HashSet / HashTable
Classic Problems | Similar Problems |
1. Two Sum | 15. 3Sum | 18. 4Sum |
349. Intersection of Two Arrays | | |
953. Verifying an Alien Dictionary | | |
359. Logger Rate Limiter | | |
1002. Find Common Characters | | |
811. Subdomain Visit Count | | |
3. Longest Substring Without Repeating Characters | | |
560. Subarray Sum Equals K | 974. Subarray Sums Divisible by K | |
380. Insert Delete GetRandom O(1) | | |
49. Group Anagrams | 438. Find All Anagrams in a String | |
138. Copy List with Random Pointer | 133. Clone Graph | |
166. Fraction to Recurring Decimal | | |
356. Line Reflection | | |
535. Encode and Decode TinyURL | | |
554. Brick Wall | | |
966. Vowel Spellchecker | | |
340. Longest Substring with At Most K Distinct Characters | | |
76. Minimum Window Substring | | |
Tree
Classic Problems | Similar Problems |
543. Diameter of Binary Tree | 124. Binary Tree Maximum Path Sum | | |
226. Invert Binary Tree | | | |
104. Maximum Depth of Binary Tree | 559. Maximum Depth of N-ary Tree | | |
101. Symmetric Tree | | | |
108. Convert Sorted Array to Binary Search Tree | | | |
112. Path Sum | 113. Path Sum II | 437. Path Sum III | |
105. Construct Binary Tree from Preorder and Inorder Traversal | | 1008. Construct Binary Search Tree from Preorder Traversal | 889. Construct Binary Tree from Preorder and Postorder Traversal | |
98. Validate Binary Search Tree | | | |
236. Lowest Common Ancestor of a Binary Tree | | | |
103. Binary Tree Zigzag Level Order Traversal | | | |
199. Binary Tree Right Side View | | | |
987. Vertical Order Traversal of a Binary Tree | | | |
114. Flatten Binary Tree to Linked List | | | |
979. Distribute Coins in Binary Tree | | | |
116. Populating Next Right Pointers in Each Node | 117. Populating Next Right Pointers in Each Node II | | |
1123. Lowest Common Ancestor of Deepest Leaves | | | |
337. House Robber III | | | |
450. Delete Node in a BST | | | |
297. Serialize and Deserialize Binary Tree | 449. Serialize and Deserialize BST | 428. Serialize and Deserialize N-ary Tree | |
968. Binary Tree Cameras | | | |
Heap
Graph (Breadth-FS)
Classic Problems | Similar Problems |
310. Minimum Height Trees | |
1162. As Far from Land as Possible | |
934. Shortest Bridge | |
542. 01 Matrix | |
1129. Shortest Path with Alternating Colors | |
Graph (Best-FS)
Classic Problems | Similar Problems |
743. Network Delay Time | |
1102. Path With Maximum Minimum Value | |
787. Cheapest Flights Within K Stops | |
Graph (DFS)
Classic Problems | Similar Problems |
332. Reconstruct Itinerary | |
200. Number of Islands | 305. Number of Islands II |
694. Number of Distinct Islands | |
785. Is Graph Bipartite? | 886. Possible Bipartition |
399. Evaluate Division | |
261. Graph Valid Tree | |
841. Keys and Rooms | |
1059. All Paths from Source Lead to Destination | |
417. Pacific Atlantic Water Flow | |
Basic Algorithms
Binary Search
Classic Problems | Similar Problems |
69. Sqrt(x) | 50. Pow(x, n) | | |
852. Peak Index in a Mountain Array | 162. Find Peak Element | 1095. Find in Mountain Array | |
704. Binary Search | 34. Find First and Last Position of Element in Sorted Array | | |
29. Divide Two Integers | | | |
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 | | |
74. Search a 2D Matrix | | | |
875. Koko Eating Bananas | 1062. Longest Repeating Substring | 1011. Capacity To Ship Packages Within D Days | 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold |
1231. Divide Chocolate | 410. Split Array Largest Sum | |
4. Median of Two Sorted Arrays | | | |
528. Random Pick with Weight | | | |
1055. Shortest Way to Form String | | | |
Breadth-First Search
Classic Problems | Similar Problems |
339. Nested List Weight Sum | 364. Nested List Weight Sum II |
994. Rotting Oranges | |
127. Word Ladder | 126. Word Ladder II |
863. All Nodes Distance K in Binary Tree | |
909. Snakes and Ladders | |
967. Numbers With Same Consecutive Differences | |
752. Open the Lock | |
675. Cut Off Trees for Golf Event | |
773. Sliding Puzzle | |
Best-First Search
Classic Problems | Similar Problems |
505. The Maze II | |
264. Ugly Number II | |
818. Race Car | |
871. Minimum Number of Refueling Stops | |
778. Swim in Rising Water | |
Depth-First Search
Classic Problems | Similar Problems |
733. Flood Fill | |
439. Ternary Expression Parser | |
394. Decode String | 224. Basic Calculator |
1376. Time Needed to Inform All Employees | |
490. The Maze | |
679. 24 Game | |
1377. Frog Position After T Seconds | |
827. Making A Large Island | |
Backtracking
Classic Problems | Similar Problems |
22. Generate Parentheses | |
78. Subsets | 90. Subsets II |
39. Combination Sum | 40. Combination Sum II |
46. Permutations | 77. Combinations |
17. Letter Combinations of a Phone Number | |
491. Increasing Subsequences | |
1087. Brace Expansion | 1096. Brace Expansion II |
489. Robot Room Cleaner | |
753. Cracking the Safe | |
1240. Tiling a Rectangle with the Fewest Squares | |
Dynamic Programming 1D
Classic Problems | Similar Problems |
303. Range Sum Query – Immutable | |
53. Maximum Subarray | |
70. Climbing Stairs | |
198. House Robber | |
91. Decode Ways | |
139. Word Break | 140. Word Break II |
300. Longest Increasing Subsequence | |
279. Perfect Squares | |
96. Unique Binary Search Trees | 95. Unique Binary Search Trees II |
1048. Longest String Chain | |
338. Counting Bits | |
413. Arithmetic Slices | |
343. Integer Break | |
1186. Maximum Subarray Sum with One Deletion | |
Dynamic Programming 1D (Multiple States)
Classic Problems | Similar Problems |
256. Paint House | |
309. Best Time to Buy and Sell Stock with Cooldown | 714. Best Time to Buy and Sell Stock with Transaction Fee |
213. House Robber II | |
801. Minimum Swaps To Make Sequences Increasing | |
978. Longest Turbulent Subarray | |
790. Domino and Tromino Tiling | |
552. Student Attendance Record II | |
Classic Problems | Similar Problems |
304. Range Sum Query 2D – Immutable | |
64. Minimum Path Sum | |
120. Triangle | |
62. Unique Paths | 63. Unique Paths II |
85. Maximal Rectangle | |
312. Burst Balloons | |
410. Split Array Largest Sum | |
1074. Number of Submatrices That Sum to Target | |
Classic Problems | Similar Problems |
1143. Longest Common Subsequence | 115. Distinct Subsequences |
712. Minimum ASCII Delete Sum for Two Strings | |
72. Edit Distance | |
10. Regular Expression Matching | 44. Wildcard Matching |
97. Interleaving String | |
Classic Problems | Similar Problems |
5. Longest Palindromic Substring | 516. Longest Palindromic Subsequence | 1312. Minimum Insertion Steps to Make a String Palindrome | 1216. Valid Palindrome III |
1027. Longest Arithmetic Subsequence | | | |
877. Stone Game | | | |
873. Length of Longest Fibonacci Subsequence | | | |
1246. Palindrome Removal | | | |
Classic Problems | Similar Problems |
265. Paint House II | |
123. Best Time to Buy and Sell Stock III | 188. Best Time to Buy and Sell Stock IV |
Dynamic Programming (Knapsack)
Classic Problems | Similar Problems |
322. Coin Change | |
377. Combination Sum IV | |
416. Partition Equal Subset Sum | |
474. Ones and Zeroes | |
Advanced Algorithms
Trie
Classic Problems | Similar Problems |
720. Longest Word in Dictionary | 208. Implement Trie (Prefix Tree) | 211. Design Add and Search Words Data Structure | 642. Design Search Autocomplete System |
Union Find
Classic Problems | Similar Problems |
547. Friend Circles | 721. Accounts Merge | 323. Number of Connected Components in an Undirected Graph | 684. Redundant Connection |
737. Sentence Similarity II | 924. Minimize Malware Spread | |
Topological Sort
Classic Problems | Similar Problems |
207. Course Scheduley | 210. Course Schedule II | 802. Find Eventual Safe States | 269. Alien Dictionary |
Boyer-Moore Voting Algorithm
Classic Problems | Similar Problems |
169. Majority Element | 229. Majority Element II | 159. Longest Substring with At Most Two Distinct Characters | 1157. Online Majority Element In Subarray |
Complex Problems
HashTable + Doubly Linked List
Classic Problems | Similar Problems |
146. LRU Cache | 460. LFU Cache |