LeetCode Top Interview Questions Questions | LeetCode 精选 TOP 面试题

By Long Luo

The Solutions of LeetCode Top Interview Questions | 精选 TOP 面试题

No.ProblemsDifficultySource CodeSolution
001Two SumEasyJava
002Add Two NumbersMediumJava
003Longest Substring Without Repeating CharactersMediumJava
004Median of Two Sorted ArraysHardJava
005Longest Palindromic SubstringMediumJava
007Reverse IntegerEasyJava
008String to Integer (atoi)MediumJava
010Regular Expression MatchingHardJava
011Container With Most WaterMediumJava
013Roman to IntegerEasyJava
014Longest Common PrefixEasyJava
017Letter Combinations of a Phone NumberMediumJava
019Remove Nth Node From End of ListEasyJava
020Valid ParenthesesEasyJava
021Merge Two Sorted ListsEasyJava
022Generate ParenthesesMediumJava
023Merge k Sorted ListsHardJava
026Remove Duplicates from Sorted ArrayEasyJava
028Implement strStr()EasyJava
029Divide Two IntegersMediumJava
033Search in Rotated Sorted ArrayMediumJava
034Search for a RangeMediumJava
035Search Insert PositionMediumJava
036Valid SudokuMediumJava
038Count and SayEasyJava
041First Missing PositiveHardJava
042Trapping Rain WaterHardJava
044Wildcard MatchingHardJava
048Rotate ImageMediumJava
049Group AnagramsMediumJava
050Pow(x, n)MediumJava
053Maximum SubarrayMediumJava
054Spiral MatrixMediumJava
055Jump GameMediumJava
056Merge IntervalsMediumJava
062Unique PathsMediumJava
066Plus OneEasyJava
070Climbing StairsEasyJava
073Set Matrix ZeroesMediumJava
075Sort ColorsMediumJava
076Minimum Window SubstringHardJava
079Word SearchMediumJava
084Largest Rectangle in HistogramHardJava
088Merge Sorted ArrayEasyJava
091Decode WaysMediumJava
094Binary Tree Inorder TraversalMediumJava
098Validate Binary Search TreeMediumJava
101Symmetric TreeEasyJava
102Binary Tree Level Order TraversalEasyJava
103Binary Tree Zigzag Level Order TraversalMediumJava
104Maximum Depth of Binary TreeEasyJava
105Construct Binary Tree from Preorder and Inorder TraversalMediumJava
108Convert Sorted Array to Binary Search TreeEasyJava
116Populating Next Right Pointers in Each NodeMediumJava
118Pascal’s TriangleEasyJava
121Best Time to Buy and Sell StockEasyJava
122Best Time to Buy and Sell Stock IIEasyJava
124Binary Tree Maximum Path SumHardJava
125Valid PalindromeEasyJava
127Word LadderMediumJava
128Longest Consecutive SequenceHardJava
130Surrounded RegionsMediumJava
131Palindrome PartitioningMediumJava
134Gas StationMediumJava
136Single NumberEasyJava
138Copy List with Random PointerMediumJava
139Word BreakMediumJava
140Word Break IIHardJava
141Linked List CycleEasyJava
146LRU CacheHardJava
148Sort ListMediumJava
149Max Points on a LineHardJava
150Evaluate Reverse Polish NotationMediumJava
152Maximum Product SubarrayMediumJava
155Min StackEasyJava
160Intersection of Two Linked ListsEasyJava
162Find Peak ElementMediumJava
163Missing RangesMedium[没权限]
166Fraction to Recurring DecimalMediumJava
169Majority ElementEasyJava
171Excel Sheet Column NumberEasyJava
172Factorial Trailing ZeroesEasyJava
179Largest NumberMediumJava
189Rotate ArrayEasyJava
190Reverse BitsEasyJava
191Number of 1 BitsEasyJava
198House RobberEasyJava
200Number of IslandsMediumJava
202Happy NumberEasyJava
204Count PrimesEasyJava
206Reverse Linked ListEasyJava
207Course ScheduleMediumJava
208Implement Trie (Prefix Tree)MediumJava
210Course Schedule IIMediumJava
212Word Search IIHardJava
215Kth Largest Element in an ArrayMediumJava
217Contains DuplicateEasyJava
218The Skyline ProblemHardJava
227Basic Calculator IIMediumJava
230Kth Smallest Element in a BSTMediumJava
234Palindrome Linked ListEasyJava
236Lowest Common Ancestor of a Binary TreeMediumJava
237Delete Node in a Linked ListEasyJava
238Product of Array Except SelfMediumJava
239Sliding Window MaximumHardJava
240Search a 2D Matrix IIMediumJava
242Valid AnagramEasyJava
251Flatten 2D VectorMedium[没权限]
253Meeting Rooms IIMedium[没权限]
268Missing NumberEasyJava
269Alien DictionaryHard[没权限]
277Find the CelebrityMedium[没权限]
279Perfect SquaresMediumJava
283Move ZeroesEasyJava
285Inorder Successor in BSTMedium[没权限]
287Find the Duplicate NumberHardJava
295Find Median from Data StreamHardJava
297Serialize and Deserialize Binary TreeHardJava
300Longest Increasing SubsequenceMediumJava
308Range Sum Query 2D - MutableMedium[没权限]
315Count of Smaller Numbers After SelfHardJava
322Coin ChangeMediumJava
324Wiggle Sort IIMediumJava
326Power of ThreeEasyJava
328Odd Even Linked ListMediumJava
329Longest Increasing Path in a MatrixHardJava
334Increasing Triplet SubsequenceMediumJava
340Longest Substring with At Most K Distinct CharactersHard[Plus]
341Flatten Nested List IteratorMediumJava
344Reverse StringEasyJava
347Top K Frequent ElementsMediumJava
348Design Tic-Tac-ToeMedium[没权限]
350Intersection of Two Arrays IIEasyJava
371Sum of Two IntegersMediumJava
378Kth Smallest Element in a Sorted MatrixMediumJava
380Insert Delete GetRandom O(1)MediumJava
384Shuffle an ArrayMediumJava
387First Unique Character in a StringEasyJava
395Longest Substring with At Least K Repeating CharactersMediumJava
412Fizz BuzzEasyJava
4544Sum IIMediumJava