Skip to content
luoxiaoke edited this page Jul 31, 2020 · 1 revision

LeetCode (370/1521)Easy 131--Medium 193--Hard 46

Algorithm exercises 🚨🚨🚨

the following problem is choose by:

the problem of Daily Challenges and Weekly Contest, and the similar problem on leetcode.com and leetcode-cn.com.


Book


----SameQuestionGroup----


Tag Progress
Array 105/261
Backtracking 15/55
Binary Indexed Tree 2/6
Binary Search 32/84
Binary Search Tree 2/15
Bit Manipulation 9/39
Brainteaser 3/5
Breadth-first Search 16/68
Concurrency 1/9
Database 3/112
Depth-first Search 39/95
Desigin 5/49
Divide and Conquer 6/19
Dynamic Programming 54/188
Geometry 2/7
Graph 9/42
Greedy 16/80
Hash Table 22/127
Heap 5/34
Linked List 27/38
Math 35/122
Memoization 1/1
Minimax 1/8
Queue 2/9
Recursion 5/15
Random 1/6
Segment Tree 3/12
Sliding Window 7/23
Sort 16/52
Stack 17/57
String 57/179
Topological Sort 4/7
Tree 54/137
Trie 3/17
Two Pointers 31/60
Union Find 5/29
other 5/?

Title Tags Difficulty
1. Two Sum Array
HashTable
Easy
2. Add Two Numbers Math
LinkedList
Medium
3.Longest Substring Without Repeating Characters String
Two Pointers
HashTables
Sliding Window
Medium
4. Median of Two Sorted Arrays.md🚨 Array
Binary Serach
Divide and Conquer
Hard
5. Longest Palindromic Substring🚨 String
Dynamic Programming
Medium
6. ZigZag Conversion String Medium
7. Reverse Integer Math Easy
8. String to Integer (atoi) String
Math
Medium
9. Palindrome Number Math Easy
10. Regular Expression Matching🚨 String
Dynamic Programming
BackTracking
Hard
11. Container With Most Water Array
Two Pointer
Medium
12. Integer to Roman Math
String
Medium
13. Roman to Integer Math
String
Easy
14. Longest Common Prefix String Easy
15. 3Sum 🚨 Array
Two Pointer
Medium
16. 3Sum Closest Array
Two Pointer
Medium
17. Letter Combinations of a Phone Number String
BackTracking
Medium
18. 4Sum 🚨 Array
Two Pointer
HashTable
Medium
19. Remove Nth Node From End of List LinkedList
Two Pointers
Medium
20. Valid Parentheses String
Stack
Easy
21. Merge Two Sorted Lists LinkedList Easy
22. Generate Parentheses String
BackTracking
Medium
23.Merge k Sorted Lists LinkedList
Divide and Conquer
Heap
Hard
24. Swap Nodes in Pairs LinkedList Medium
25. Reverse Nodes in k-Group LinkedList Hard
26. Remove Duplicates from Sorted Array Array
Two Pointer
Easy
27. Remove Element Array
Two Pointer
Easy
28. Implement strStr() String
Two Pointers
Easy
31. Next Permutation 🚨 Array Medium
32. Longest Valid Parentheses🚨 String
Dynamic Programming
Hard
33. Search in Rotated Sorted Array 🚨 Array
Binary Serach
Medium
34. Find First and Last Position of Element in Sorted Array 🚨 Array
Binary Serach
Medium
35. Search Insert Position Array
Binary Serach
Easy
38. Count and Say String Easy
39. Combination Sum Array
Backtracking
Medium
40. Combination Sum II Array
Backtracking
Medium
41. First Missing Positive🚨 Array Hard
43. Multiply Strings Math
String
Medium
44. Wildcard Matching String
Dynamic Programming
Greedy
Backtracking
Hard
49. Group Anagrams String
HashTable
Medium
50. Pow(x, n) Math
BinarySearch
Medium
54. Spiral Matrix Array Medium
58. Length of Last Word String Easy
60. Permutation Sequence Math
Backtracking
Medium
61. Rotate List LinkedList
Two Pointers
Medium
62. Unique Paths Array
Dynamic Programming
Medium
63. Unique Paths II Array
Dynamic Programming
Medium
64. Minimum Path Sum Array
Dynamic Programming
Medium
65. Valid Number String
Math
Hard
66. Plus One Array Easy
67. Add Binary Math
String
Easy
70. Climbing Stairs Dynamic Programming Easy
75. Sort Colors Array
Two Pointer
Sort
Medium
78. Subsets Array
Backtracking
Bit Manipulation
Medium
79. Word Search Array
BackTracking
Medium
82. Remove Duplicates from Sorted List II LinkedList Medium
83. Remove Duplicates from Sorted List LinkedList Easy
84. Largest Rectangle in Histogram Array
Stack
Hard
86. Partition List LinkedList
Two Pointers
Medium
91. Decode Ways Dynamic Programming
String
Medium
92. Reverse Linked List II LinkedList Medium
94. Binary Tree Inorder Traversal Stack
HashTable
Tree
Medium
95. Unique Binary Search Trees II Tree
Dynamic Programming
Medium
96. Unique Binary Search Trees Tree
Dynamic Programming
Medium
97. Interleaving String String
Dynamic Programming
Hard
98. Validate Binary Search Tree Tree
DFS
Medium
100. Same Tree DFS
Tree
Easy
101. Symmetric Tree DFS
BFS
Tree
Easy
102. Binary Tree Level Order Traversal Tree
BFS
Medium
103. Binary Tree Zigzag Level Order Traversal Tree
BFS
Stack
Medium
104. Maximum Depth of Binary Tree DFS
Tree
Easy
105. Construct Binary Tree from Preorder and Inorder Traversal Tree
Array
DFS
Medium
106. Construct Binary Tree from Inorder and Postorder Traversal Tree
Array
DFS
Medium
107. Binary Tree Level Order Traversal II Tree
BFS
Easy
108. Convert Sorted Array to Binary Search Tree DFS
Tree
Easy
109. Convert Sorted List to Binary Search Tree LinkedList
DFS
Medium
112. Path Sum DFS
Tree
Easy
120. Triangle Array
Dynamic Programming
Medium
121. Best Time to Buy and Sell Stock Array
Dynamic Programming
Easy
122. Best Time to Buy and Sell Stock II Array
Greedy
Easy
123. Best Time to Buy and Sell Stock III Array
Dynamic Programming
Hrad
124. Binary Tree Maximum Path Sum DFS
Tree
Hard
125. Valid Palindrome String
Two Pointer
Easy
126. Word Ladder II 🚨 Array
Backtracking
String
BFS
Hard
127. Word Ladder 🚨 BFS Medium
128. Longest Consecutive Sequence 🚨 Array
Union Find
Hard
129. Sum Root to Leaf Numbers DFS
Tree
Medium
130. Surrounded Regions DFS
BFS
Union Find
Medium
136. Single Number HashTable
Bit Manipulation
Easy
137. Single Number II Bit Manipulation Medium
138. Copy List with Random Pointer LinkedList
HashTable
Medium
139. Word Break Dynamic Programming Medium
140. Word Break II Dynamic Programming
Backtracking
Hard
141. Linked List Cycle LinkedList
Two Pointers
Easy
142. Linked List Cycle II LinkedList
Two Pointers
Medium
143. Reorder List LinkedList Medium
144. Binary Tree Preorder Traversal Stack
Tree
Medium
145. Binary Tree Postorder Traversal Tree
Stack
Hard
151. Reverse Words in a String String Medium
153. Find Minimum in Rotated Sorted Array Array
BinarySearch
Medium
154. Find Minimum in Rotated Sorted Array II Array
BinarySearch
Hard
155. Min Stack Stack
Design
Easy
167. Two Sum II - Input array is sorted Array
Two pointers
Binary Search
Easy
169. Majority Element Array
Divide and Conquer
Bit Manipulation
Easy
173. Binary Search Tree Iterator Tree
Stack
Design
Medium
174. Dungeon Game Dynamic Programming
Binary Search
Hard
188. Best Time to Buy and Sell Stock IV Dynamic Programming Hard
189. Rotate Array Array Easy
190. Reverse Bits Bit Manipulation Easy
198. House Robber Dynamic Programming Easy
203. Remove Linked List Elements LinkedList Easy
204. Count Primes Math
HashTable
Easy
206. Reverse Linked List LinkedList Easy
207. Course Schedule DFS
BFS
Graph
Topological Sort
Medium
208. Implement Trie (Prefix Tree) Trie
Design
Medium
209. Minimum Size Subarray Sum Array
Two Pointer
Binary Search
Medium
210. Course Schedule II DFS
BFS
Graph
Topological Sort
Medium
212. Word Search II Trie
Backtracking
Hard
215. Kth Largest Element in an Array 🚨 Divide and Conquer
Heap
Medium
216. Combination Sum III Array
Backtracking
Medium
217. Contains Duplicate Array
HashTable
Easy
221. Maximal Square Dynamic Programming Medium
222. Count Complete Tree Nodes Tree
Binary Search
Medium
226. Invert Binary Tree Tree Easy
230. Kth Smallest Element in a BST Binary Search
Tree
Medium
231. Power of Two Math
Bit Manipulation
Easy
237. Delete Node in a Linked List LinkedList Easy
238. Product of Array Except Self Array Medium
258. Add Digits Math Easy
260. Single Number III Bit Manipulation Medium
263. Ugly Number Math Easy
264. Ugly Number II Math
Dynamic Programming
Heap
Medium
268. Missing Number Array
Math
Bit Manipulation
Easy
274. H-Index Sort
HashTable
Medium
275. H-Index II Binary Search Medium
279. Perfect Squares 🚨 Dynamic Programming
BFS
Math
Medium
283. Move Zeroes Array
Two pointers
Easy
287. Find the Duplicate Number Array
Two pointers
Binary Search
Medium
292. Nim Game Brainteaser
Minimax
Easy
297. Serialize and Deserialize Binary Tree Tree
Design
Hard
300. Longest Increasing Subsequence Binary Search
Dynamic Programming
Medium
303. Range Sum Query - Immutable Dynamic Programming Easy
307. Range Sum Query - Mutable Binary Indexed Tree
Segment Tree
Medium
309. Best Time to Buy and Sell Stock with Cooldown 🚨 Dynamic Programming Medium
312. Burst Balloons 🚨 Divide and Conquer
Dynamic Programming
Hard
315. Count of Smaller Numbers After Self Binary Search
Binary Indexed Tree
Divide and Conquer
Sort
Segment Tree
Hard
319. Bulb Switcher Math
Brainteaser
Medium
322. Coin Change 🚨 Dynamic Programming Medium
328. Odd Even Linked List LinkedList Medium
329. Longest Increasing Path in a Matrix DFS
TopologicalSort
Memoization
Hard
332. Reconstruct Itinerary 🚨 DFS
Graph
Medium
343. Integer Break Math
Dynamic Programming
Medium
344. Reverse String String
Two Pointers
Easy
347. Top K Frequent Elements HashTable
Heap
Medium
349. Intersection of Two Arrays Binary Search
Two Pointers
HashTable
Sort
Easy
350. Intersection of Two Arrays II HashTable
Two Pointers
BinarySearch
Sort
Easy
368. Largest Divisible Subset Dynamic Programming
Math
Medium
378. Kth Smallest Element in a Sorted Matrix Binary Search
Heap
Medium
392. Is Subsequence Binary Search
Dynamic Programming
Greedy
Medium
394. Decode String DFS
Stack
Medium
406. Queue Reconstruction by Height Greedy Medium
410. Split Array Largest Sum Binary Search
Dynamic Programming
Hard
430. Flatten a Multilevel Doubly Linked List LinkedList
DFS
Medium
441. Arranging Coins Math
BinarySearch
Easy
442. Find All Duplicates in an Array Array Medium
445. Add Two Numbers II LinkedList Medium
448. Find All Numbers Disappeared in an Array Array Easy
461. Hamming Distance Bit Manipulation Easy
463. Island Perimeter HashTable Easy
468. Validate IP Address String Medium
485. Max Consecutive Ones Array Easy
494. Target Sum 🚨 Dynamic Programming
DFS
Medium
495. Teemo Attacking Array Medium
496. Next Greater Element I Stack Easy
503. Next Greater Element II Stack Medium
509. Fibonacci Number Array Easy
513. Find Bottom Left Tree Value DFS
BFS
Tree
Medium
515. Find Largest Value in Each Tree Row DFS
BFS
Tree
Medium
518. Coin Change 2 Dynamic Programming Medium
520. Detect Capital String Easy
521. Longest Uncommon Subsequence I String Easy
523. Continuous Subarray Sum 🚨 Math
Dynamic Programming
Medium
525. Contiguous Array 🚨 HashTable Medium
528. Random Pick with Weight 🚨 Random
BinarySerach
Medium
530. Minimum Absolute Difference in BST Tree Easy
535. Encode and Decode TinyURL Math
HashTable
Medium
537. Complex Number Multiplication Math
String
Medium
539. Minimum Time Difference String Easy
556. Next Greater Element III String Medium
557. Reverse Words in a String III String Easy
559. Maximum Depth of N-ary Tree DFS
BFS
Tree
Easy
561. Array Partition I Array Easy
565. Array Nesting Array Easy
566. Reshape the Matrix Array Easy
581. Shortest Unsorted Continuous Subarray Array Easy
589. N-ary Tree Preorder Traversal Tree Easy
595. Big Countries Database Easy
617. Merge Two Binary Trees Tree Easy
621. Task Scheduler Array
Greedy
Queue
Medium
627. Swap Salary Datebase Easy
628. Maximum Product of Three Numbers Array
Math
Easy
630. Course Schedule III Greedy Hard
645. Set Mismatch Math
HashTable
Easy
654.Maximum Binary Tree Tree Medium
657. Judge Route Circle String Easy
661. Image Smoother Array Easy
662. Maximum Width of Binary Tree Tree Medium
667. Beautiful Arrangement II Array Medium
674. Longest Continuous Increasing Subsequence Array Easy
692. Top K Frequent Words HashTable
Heap
Trie
Medium
695. Max Area of Island Array
DFS
Medium
697. Degree of an Array Array Easy
700. Search in a Binary Search Tree Tree Easy
701. Insert into a Binary Search Tree Tree Medium
709.To Lower Case String Easy
714. Best Time to Buy and Sell Stock with Transaction Fee Array
Dynamic Programming
Greedy
Medium
717. 1-bit and 2-bit Characters Array Easy
718. Maximum Length of Repeated Subarray Array
BinarySearch
HashTable
Dynamic Programming
Medium
725. Split Linked List in Parts LinkedList Medium
726. Number of Atoms HashTable
Stack
Recursion
Hard
728. Self Dividing Numbers Math Easy
739. Daily Temperatures Stack
HashTable
Medium
741. Cherry Pickup 🚨🚨🚨 Dynamic Programming Hard
746. Min Cost Climbing Stairs Array
Dynamic Programming
Easy
763. Partition Labels Greedy
Two Pointers
Medium
766. Toeplitz Matrix Array Easy
769. Max Chunks To Make Sorted Array Medium
771. Jewels and Stones HashTable Easy
783. Minimum Distance Between BST Nodes Tree
Recursive
Easy
785. Is Graph Bipartite? DFS
BFS
Graph
Medium
787. Cheapest Flights Within K Stops 🚨 Dynamic Programming
DFS
Heap
Medium
791. Custom Sort String String Medium
797. All Paths From Source to Target DFS Medium
804. Unique Morse Code Words String Easy
807. Max Increase to Keep City Skyline other Medium
814. Binary Tree Pruning Tree Medium
817. Linked List Components LinkedList Medium
824. Goat Latin String Easy
830. Positions of Large Groups Array Easy
832. Flipping an Image Array Easy
837. New 21 Game 🚨 Dynamic Programming Medium
841. Keys and Rooms DFS
Graph
Medium
852. Peak Index in a Mountain Array Binary Search Easy
862. Shortest Subarray with Sum at Least K 🚨 Queue
Binary Search
Hard
863. All Nodes Distance K in Binary Tree Tree
DFS
BFS
Medium
872. Leaf-Similar Trees DFS
Tree
Easy
875. Koko Eating Bananas BinarySearch Medium
876. Middle of the Linked List LinkedList Easy
889. Construct Binary Tree from Preorder and Postorder Traversal Tree Medium
890. Find and Replace Pattern String Easy
894. All Possible Full Binary Trees🚨 Tree
Recursion
Medium
897. Increasing Order Search Tree DFS
Tree
Easy
904. Fruit Into Baskets Two Pointers Medium
905. Sort Array By Parity Array Easy
925. Long Pressed Name String
Two Pointer
Easy
929. Unique Email Addresses String Easy
930. Binary Subarrays With Sum Two Pointers
HashTable
Medium
938. Range Sum of BST Tree
Recursion
Easy
942. DI String Match Math Easy
950. Reveal Cards In Increasing Order Array Medium
957. Prison Cells After N Days HashTable Medium
959. Regions Cut By Slashes DFS
Graph
Union Find
Medium
961. N-Repeated Element in Size 2N Array Easy
965. Univalued Binary Tree Tree Easy
974. Subarray Sums Divisible by K Array
HashTable
Medium
977.Squares of a Sorted Array Array
TwoPointers
Easy
978. Longest Turbulent Subarray Array
Dynamic Programming
Silding Window
Medium
979. Distribute Coins in Binary Tree DFS
Tree
Medium
980. Unique Paths III DFS
BackTracking
Hard
983. Minimum Cost For Tickets 🚨 Dynamic Programming Medium
990. Satisfiability of Equality Equations Union Find
Graph
Medium
992. Subarrays with K Different Integers Two Pointers
HashTable
Sliding Window
Hard
1002. Find Common Characters Array
HashTable
Easy
1004. Max Consecutive Ones III Two Pointers
Sliding Window
Medium
1008. Construct Binary Search Tree from Preorder Traversal Tree Medium
1011. Capacity To Ship Packages Within D Days Array
Binary Search
Medium
1014. Best Sightseeing Pair 🚨 Array Medium
1019. Next Greater Node In Linked List 🚨 LinkedList
Stack
Medium
1021. Remove Outermost Parentheses Stack Easy
1025. Divisor Game Math
Dynamic Programming
Easy
1026. Maximum Difference Between Node and Ancestor DFS
Tree
Medium
1028. Recover a Tree From Preorder Traversal DFS
Tree
Hard
1029. Two City Scheduling Greedy Easy
1038. Binary Search Tree to Greater Sum Tree Binary Search Tree Medium
1044. Longest Duplicate Substring 🚨🚨🚨 Binary Search
HashTable
Hard
1051. Height Checker Array Easy
1053. Previous Permutation With One Swap Array
Greedy
Medium
1079. Letter Tile Possibilities 🚨 BackTracking Medium
1108.Defanging an IP Address String Easy
1109. Corporate Flight Bookings 🚨 Math
Array
Medium
1110. Delete Nodes And Return Forest DFS
Tree
Medium
1115. Print FooBar Alternately Concurrency Medium
1122. Relative Sort Array Array
Sort
Easy
1130. Minimum Cost Tree From Leaf Values Tree
Stack
Dynamic Programming
Medium
1137. N-th Tribonacci Number Recursive Easy
1143. Longest Common Subsequence Dynamic Programming Medium
1155. Number of Dice Rolls With Target Sum Dynamic Programming Medium
1179. Reformat Department Table🚨 Datebase Easy
1207. Unique Number of Occurrences HashTable Easy
1221. Split a String in Balanced Strings String Easy
1234. Replace the Substring for Balanced String String
Two Pointers
Medium
1248. Count Number of Nice Subarrays Two Pointers Easy
1249. Minimum Remove to Make Valid Parentheses String
Stack
Medium
1252. Cells with Odd Values in a Matrix Array Easy
1261. Find Elements in a Contaminated Binary Tree HashTable
Tree
Medium
1266. Minimum Time Visiting All Points Array
Geometry
Easy
1281. Subtract the Product and Sum of Digits of an Integer Math Easy
1282. Group the People Given the Group Size They Belong To🚨 Greedy Medium
1290.Convert Binary Number in a Linked List to Integer LinkedList
Bit Manipulation
Easy
1300. Sum of Mutated Array Closest to Target Array
BinarySearch
Medium
1302. Deepest Leaves Sum DFS
Tree
Medium
1314. Matrix Block Sum Dynamic Programming Medium
1315. Sum of Nodes with Even-Valued Grandparent DFS
Tree
Medium
1340. Jump Game V 🚨 Dynamic Programming Hard
1344. Angle Between Hands of a Clock Math Medium
1358. Number of Substrings Containing All Three Characters String Medium
1419. Minimum Number of Frogs Croaking String Medium
1425. Constrained Subsequence Sum Dynamic Programming Hard
1431. Kids With the Greatest Number of Candies Array Easy
1446. Consecutive Characters String Easy
1450. Number of Students Doing Homework at a Given Time Array Easy
1451. Rearrange Words in a Sentence String
Sort
Medium
1452. People Whose List of Favorite Companies Is Not a Subset of Another List String
Sort
Medium
1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence String Easy
1456. Maximum Number of Vowels in a Substring of Given Length String
Sliding Window
Medium
1457. Pseudo-Palindromic Paths in a Binary Tree DFS
Tree
Bit Manipulation
Medium
1458. Max Dot Product of Two Subsequences 🚨 Dynamic Programming Hard
1462. Course Schedule IV Graph
TopologicalSort
Medium
1464. Maximum Product of Two Elements in an Array Array Easy
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts DFS
Tree
Medium
1466. Reorder Routes to Make All Paths Lead to the City Zero DFS
Tree
Medium
1470. Shuffle the Array Array Easy
1471. The k Strongest Values in an Array Array
Sort
Medium
1472. Design Browser History Design Medium
1473. Paint House III 🚨 Dynamic Programming Hard
1480. Running Sum of 1d Array Array Easy
1481. Least Number of Unique Integers after K Removals Array
Sort
Medium
1482. Minimum Number of Days to Make m Bouquets 🚨🚨🚨 Binary Search
Array
Medium
1483. Kth Ancestor of a Tree Node 🚨🚨 Dynamic Programming Hard
1486. XOR Operation in an Array Array
Bit Manipulation
Easy
1487. Making File Names Unique String
HashTable
Medium
1488. Avoid Flood in The City Array
HashTable
Medium
1491. Average Salary Excluding the Minimum and Maximum Salary Array
Sort
Easy
1492. The kth Factor of n Math Medium
1493. Longest Subarray of 1's After Deleting One Element Array Medium
1496. Path Crossing String Easy
1497. Check If Array Pairs Are Divisible by k Array
Math
Greedy
Medium
1498. Number of Subsequences That Satisfy the Given Sum Condition 🚨 Sort
Sliding Window
Medium
1499. Max Value of Equation 🚨 Array
Sliding Window
Hard
1502. Can Make Arithmetic Progression From Sequence Array
Sort
Easy
1503. Last Moment Before All Ants Fall Out of a Plank Array
Brainteaser
Medium
1504. Count Submatrices With All Ones Dynamic Programming Medium
1505. Minimum Possible Integer After at Most K Adjacent Swaps On Digits 🚨 Greedy Hard
1507. Reformat Date String Easy
1508. Range Sum of Sorted Subarray Sums Array
Sort
Medium
1509. Minimum Difference Between Largest and Smallest Value in Three Moves Array
Sort
Medium
1510. Stone Game IV Dynamic Programming Hard
1512. Number of Good Pairs Array
Math
HashTable
Easy
1513. Number of Substrings With Only 1s String
Math
Medium
1514. Path with Maximum Probability 🚨🚨🚨 Graph Medium
1515. Best Position for a Service Centre 🚨🚨 Geometry Hard
1518. Water Bottles Greedy Easy
1519. Number of Nodes in the Sub-Tree With the Same Label BFS
DFS
Medium
1520. Maximum Number of Non-Overlapping Substrings 🚨🚨 Greedy Medium
1521. Find a Value of a Mysterious Function Closest to Target 🚨🚨🚨 BinarySearch
Segment Tree
Bit Manipulation
Hard
1523. Count Odd Numbers in an Interval Range Math Easy
1528. Shuffle String Sort Easy
1529. Bulb Switcher IV String Medium
1530. Number of Good Leaf Nodes Pairs Tree
DFS
Medium
Clone this wiki locally