17.1 LeetCode

LeetCode Algorithm

(Notes: “♥” means you need to buy a book from Leetcode)

#TitleSolutionDifficulty
1030Matrix Cells in Distance OrderC++Easy
1029Two City SchedulingC++Easy
993Cousins in Binary TreeC++Easy
991Broken CalculatorC++Medium
990Satisfiability of Equality EquationsC++Medium
989Add to Array-Form of IntegerC++Easy
988Smallest String Starting From LeafC++Medium
987Vertical Order Traversal of a Binary TreeC++Medium
986Interval List IntersectionsC++Medium
985Sum of Even Numbers After QueriesC++Easy
984String Without AAA or BBBC++Easy
983Minimum Cost For TicketsC++Medium
981Time Based Key-Value StoreC++Medium
980Unique Paths IIIC++Hard
979Distribute Coins in Binary TreeC++Medium
978Longest Turbulent SubarrayC++,PythonMedium
977Squares of a Sorted ArrayC++, PythonEasy
976Largest Perimeter TriangleC++, PythonEasy
971Flip Binary Tree To Match Preorder TraversalPythonMedium
969Pancake SortingPythonMedium
958Check Completeness of a Binary TreePythonMedium
951Flip Equivalent Binary TreesPythonMedium
950Reveal Cards In Increasing OrderPythonMedium
941Valid Mountain ArrayPythonEasy
931Minimum Falling Path SumC++Medium
922Sort Array By Parity IIC++Easy
914X of a Kind in a Deck of CardsPythonEasy
905Sort Array By ParityC++Easy
859Buddy StringsC++Easy
858Mirror ReflectionC++Medium
852Peak Index in a Mountain ArrayC++Easy
849Maximize Distance to Closest PersonPythonEasy
844Backspace String CompareC++Easy
837Most Common WordC++Easy
830Positions of Large GroupsPythonEasy
804Unique Morse Code WordsC++Easy
771Jewels and StonesC++Easy
747Largest Number At Least Twice of OthersPythonEasy
746Min Cost Climbing StairsC++, PythonEasy
721Accounts MergeC++Medium
7171-bit and 2-bit CharactersPythonEasy
714Best Time to Buy and Sell Stock with Transaction FeeC++Medium
712Minimum ASCII Delete Sum for Two StringsC++Medium
695Max Area of IslandC++Medium
687Longest Univalue PathPythonEasy
684Redundant ConnectionPythonMedium
674Longest Continuous Increasing SubsequencePythonEasy
671Second Minimum Node In a Binary TreePythonEasy
665Non-decreasing ArrayPythonEasy
662Maximum Width of Binary TreePythonMedium
661Image SmootherPythonEasy
655Print Binary TreePythonMedium
652Find Duplicate SubtreesPythonMedium
647Palindromic SubstringsC++Medium
643Maximum Average Subarray IC++, PythonEasy
628Maximum Product of Three NumbersPythonEasy
623Add One Row to TreePythonMedium
581Shortest Unsorted Continuous SubarrayPythonEasy
572Subtree of Another TreePythonEasy
563Binary Tree TiltPythonEasy
547Friend CirclesC++Medium
543Diameter of Binary TreePythonEasy
538Convert BST to Greater TreePythonEasy
532K-diff Pairs in an ArrayPythonEasy
520Detect CapitalC++Easy
518Coin Change 2C++Medium
509Fibonacci NumberC++, PythonEasy
477Total Hamming DistanceC++Medium
463Island PerimeterC++Easy
450DeleteNodeInABSTPythonMedium
449Serialize and Deserialize BSTPythonMedium
437Path Sum IIIPythonMedium
418SentenceScreenFittingC++Easy
416Partition Equal Subset SumC++Medium
415Add StringsC++Easy
414Third Maximum NumberC++, PythonEasy
413Arithmetic SlicesC++Medium
412Fizz BuzzC++Easy
410Split Array Largest SumC++Hard
409Longest PalindromeC++Easy
406Queue Reconstruction by HeightC++Medium
405Convert a Number to HexadecimalC++Easy
404Sum of Left LeavesC++, PythonEasy
403Frog JumpC++Hard
402Remove K DigitsC++Medium
401Binary WatchC++Easy
400Nth DigitC++Easy
399Evaluate DivisionC++Medium
398Random Pick IndexC++Medium
397Integer ReplacementC++Medium
396Rotate FunctionC++Easy
395Longest Substring with At Least K Repeating CharactersC++Medium
394Decode StringC++Medium
393UTF-8 ValidationC++Medium
392Is SubsequenceC++Medium
391Perfect RectangleC++Hard
390Elimination GameC++Medium
389Find the DifferenceC++Easy
388Longest Absolute File PathC++Medium
387First Unique Character in a StringC++Easy
386Lexicographical NumbersC++Medium
385Mini ParserC++Medium
384Shuffle an ArrayC++Medium
383Ransom NoteC++Easy
382Linked List Random NodeC++Medium
381Insert Delete GetRandom O(1) - Duplicates allowedC++Hard
380Insert Delete GetRandom O(1)C++Hard
377Combination Sum IVC++Medium
376Wiggle SubsequenceC++Medium
371Sum of Two IntegersC++Easy
367Valid Perfect SquareC++Easy
357Count Numbers with Unique DigitsC++Medium
350Intersection of Two Arrays IIC++Easy
349Intersection of Two ArraysC++Easy
347Top K Frequent ElementsC++Medium
345Reverse Vowels of a StringC++Easy
344Reverse StringC++Easy
343Integer BreakC++Medium
342Power of FourC++Easy
341Flatten Nested List IteratorC++Medium
338Counting BitsC++Medium
337House Robber IIIC++, PythonMedium
336Palindrome PairsC++Hard
334Increasing Triplet SubsequenceC++Medium
332Reconstruct ItineraryC++Medium
331Verify Preorder Serialization of a Binary TreeC++Medium
330Patching ArrayC++Medium
329Longest Increasing Path in a MatrixC++Medium
328Odd Even Linked ListC++Easy
327Count of Range SumC++Hard
326Power of ThreeC++Easy
324Wiggle Sort IIC++Medium
322Coin ChangeC++Medium
321Create Maximum NumberC++Hard
319Bulb SwitcherC++Medium
318Maximum Product of Word LengthsC++Medium
316Remove Duplicate LettersC++Hard
315Count of Smaller Numbers After SelfC++Hard
313Super Ugly NumberC++Medium
312Burst BalloonsC++Hard
310Minimum Height TreesC++Medium
309Best Time to Buy and Sell Stock with CooldownC++Medium
307Range Sum Query - MutableC++Medium
306Additive NumberC++Medium
304Range Sum Query 2D - ImmutableC++Medium
303Range Sum Query - ImmutableC++Easy
301Remove Invalid ParenthesesC++Hard
300Longest Increasing SubsequenceC++Medium
299Bulls and CowsC++Easy
297Serialize and Deserialize Binary TreeC++Medium
295Find Median from Data StreamC++Hard
292Nim GameC++Easy
290Word PatternC++Easy
289Game of LifeC++Medium
287Find the Duplicate NumberC++, PythonHard
285Inorder Successor in BSTJavaMedium
284Peeking IteratorC++Medium
283Move ZeroesC++Easy
282Expression Add OperatorsC++Hard
279Perfect SquaresC++Medium
278First Bad VersionC++, JavaEasy
275H-Index IIC++Medium
274H-IndexC++Medium
273Integer to English WordsC++Medium
268Missing NumberC++Medium
264Ugly Number IIC++Medium
263Ugly NumberC++Easy
260Single Number IIIC++Medium
258Add DigitsC++Easy
257Binary Tree PathsC++Easy
242Valid AnagramC++, JavaEasy
241Different Ways to Add ParenthesesC++, PythonMedium
240Search a 2D Matrix IIC++, Java, PythonMedium
239Sliding Window MaximumC++Hard
238Product of Array Except SelfC++Medium
237Delete Node in a Linked ListC++Easy
236Lowest Common Ancestor of a Binary TreeC++, Java, PythonMedium
235Lowest Common Ancestor of a Binary Search TreeC++, PythonEasy
234Palindrome Linked ListC++Easy
233Number of Digit OneC++Medium
232Implement Queue using StacksC++, JavaEasy
231Power of TwoC++Easy
230Kth Smallest Element in a BSTC++, PythonMedium
229Majority Element IIC++Medium
228Summary RangesC++Easy
227Basic Calculator IIC++Medium
226Invert Binary TreeC++Easy
225Implement Stack using QueuesC++, JavaMedium
224Basic CalculatorC++Medium
223Rectangle AreaC++Easy
222Count Complete Tree NodesC++, PythonMedium
221Maximal SquareC++Medium
220Contains Duplicate IIIC++, PythonMedium
219Contains Duplicate IIC++, PythonEasy
218The Skyline ProblemC++Hard
217Contains DuplicateC++Easy
216Combination Sum IIIC++Medium
215Kth Largest Element in an ArrayC++Medium
214Shortest PalindromeC++Hard
213House Robber IIC++Medium
212Word Search IIC++Hard
211Add and Search Word - Data structure designC++Medium
210Course Schedule IIC++Medium
209Minimum Size Subarray SumC++Medium
208Implement Trie (Prefix Tree)C++Medium
207Course ScheduleC++Medium
206Reverse Linked ListC++, JavaEasy
205Isomorphic StringsC++Easy
204Count PrimesC++Easy
203Remove Linked List ElementsC++Easy
202Happy NumberC++, PythonEasy
201Bitwise AND of Numbers RangeC++Medium
200Number of IslandsC++, PythonMedium
199Binary Tree Right Side ViewC++Medium
198House RobberC++, PythonEasy
191Number of 1 BitsC++Easy
190Reverse BitsC++Easy
189Rotate ArrayC++, JavaEasy
188Best Time to Buy and Sell Stock IVC++Hard
187Repeated DNA SequencesC++Medium
186Reverse Words in a String IIC++Medium
179Largest NumberC++Medium
174Dungeon GameC++Hard
173Binary Search Tree IteratorC++, Java, PythonMedium
172Factorial Trailing ZeroesC++Easy
171Excel Sheet Column NumberC++Easy
170Two Sum III - Data structure designC++Easy
169Majority ElementC++Easy
168Excel Sheet Column TitleC++Easy
167Two Sum II - Input array is sortedC++Medium
166Fraction to Recurring DecimalC++Medium
165Compare Version NumbersC++Easy
164Maximum GapC++Hard
163Missing RangesC++Medium
162Find Peak ElementC++, JavaMedium
161One Edit DistanceC++Medium
160Intersection of Two Linked ListsC++Easy
159Longest Substring with At Most Two Distinct CharactersC++Hard
158Read N Characters Given Read4 II - Call multiple timesC++Hard
157Read N Characters Given Read4C++Easy
156Binary Tree Upside DownC++Medium
155Min StackC++, JavaEasy
154Find Minimum in Rotated Sorted Array IIC++Hard
153Find Minimum in Rotated Sorted ArrayC++, JavaMedium
152Maximum Product SubarrayC++Medium
151Reverse Words in a StringC++, JavaMedium
150Evaluate Reverse Polish NotationC++Medium
149Max Points on a LineC++Hard
148Sort ListC++, PythonMedium
147Insertion Sort ListC++, PythonMedium
146LRU CacheC++, JavaHard
145Binary Tree Postorder TraversalC++, PythonHard
144Binary Tree Preorder TraversalC++, JavaMedium
143Reorder ListC++, PythonMedium
142Linked List Cycle IIC++, PythonMedium
141Linked List CycleC++Medium
140Word Break IIC++Hard
139Word BreakC++Medium
138Copy List with Random PointerC++, PythonHard
137Single Number IIC++Medium
136Single NumberC++Medium
135CandyC++Hard
134Gas StationC++Medium
133Clone GraphC++Medium
132Palindrome Partitioning IIC++Hard
131Palindrome PartitioningC++Medium
130Surrounded RegionsC++Medium
129Sum Root to Leaf NumbersC++, PythonMedium
128Longest Consecutive SequenceC++Hard
127Word LadderC++Medium
126Word Ladder IIC++Hard
125Valid PalindromeC++, JavaEasy
124Binary Tree Maximum Path SumC++, JavaHard
123Best Time to Buy and Sell Stock IIIC++Hard
122Best Time to Buy and Sell Stock IIC++Medium
121Best Time to Buy and Sell StockC++Medium
120TriangleC++, JavaMedium
119Pascal’s Triangle IIC++Easy
118Pascal’s TriangleC++Easy
117Populating Next Right Pointers in Each Node IIC++, PythonHard
116Populating Next Right Pointers in Each NodeC++, PythonMedium
115Distinct SubsequencesC++Hard
114Flatten Binary Tree to Linked ListC++, PythonMedium
113Path Sum IIC++, PythonMedium
112Path SumC++Easy
111Minimum Depth of Binary TreeC++Easy
110Balanced Binary TreeC++, JavaEasy
109Convert Sorted List to Binary Search TreeC++Medium
108Convert Sorted Array to Binary Search TreeC++Medium
107Binary Tree Level Order Traversal IIC++Easy
106Construct Binary Tree from Inorder and Postorder TraversalC++, PythonMedium
105Construct Binary Tree from Preorder and Inorder TraversalC++, PythonMedium
104Maximum Depth of Binary TreeC++, JavaEasy
103Binary Tree Zigzag Level Order TraversalC++, PythonMedium
102Binary Tree Level Order TraversalC++, JavaEasy
101Symmetric TreeC++Easy
100Same TreeC++Easy
99Recover Binary Search TreeC++Hard
98Validate Binary Search TreeC++, Java, PythonMedium
97Interleaving StringC++Hard
96Unique Binary Search TreesC++, PythonMedium
95Unique Binary Search Trees IIC++, PythonMedium
94Binary Tree Inorder TraversalC++Medium
93Restore IP AddressesC++Medium
92Reverse Linked List IIC++, Java, PythonMedium
91Decode WaysC++Medium
90Subsets IIC++, JavaMedium
89Gray CodeC++Medium
88Merge Sorted ArrayC++Easy
87Scramble StringC++Hard
86Partition ListC++, PythonMedium
85Maximal RectangleC++Hard
84Largest Rectangle in HistogramC++Hard
83Remove Duplicates from Sorted ListC++Easy
82Remove Duplicates from Sorted List IIC++, PythonMedium
81Search in Rotated Sorted Array IIC++Medium
80Remove Duplicates from Sorted Array IIC++Medium
79Word SearchC++Medium
78SubsetsC++, Java, PythonMedium
77CombinationsC++Medium
76Minimum Window SubstringC++Hard
75Sort ColorsC++Medium
74Search a 2D MatrixC++, JavaMedium
73Set Matrix ZeroesC++Medium
72Edit DistanceC++Hard
71Simplify PathC++Medium
70Climbing StairsC++, JavaEasy
69Sqrt(x)C++Medium
68Text JustificationC++Hard
67Add BinaryC++Easy
66Plus OneC++Easy
65Valid NumberC++Easy
64Minimum Path SumC++, JavaMedium
63Unique Paths IIC++, JavaMedium
62Unique PathsC++, JavaMedium
61Rotate ListC++Medium
60Permutation SequenceC++Medium
59Spiral Matrix IIC++Medium
58Length of Last WordC++, JavaEasy
57Insert IntervalC++Hard
56Merge IntervalsC++Hard
55Jump GameC++Medium
54Spiral MatrixC++Medium
53Maximum SubarrayC++Medium
52N-Queens IIC++Hard
51N-QueensC++Hard
50“Pow(x, n)”C++, JavaMedium
49Group AnagramsC++Medium
48Rotate ImageC++Medium
47Permutations IIC++Hard
46PermutationsC++Medium
45Jump Game IIC++Hard
44Wildcard MatchingC++Hard
43Multiply StringsC++Medium
42Trapping Rain WaterC++Hard
41First Missing PositiveC++Hard
40Combination Sum IIC++Medium
39Combination SumC++Medium
38Count and SayC++, JavaEasy
37Sudoku SolverC++Hard
36Valid SudokuC++Easy
35Search Insert PositionC++, JavaMedium
34Search for a RangeC++, JavaMedium
33Search in Rotated Sorted ArrayC++, JavaHard
32Longest Valid ParenthesesC++Hard
31Next PermutationC++Medium
30Substring with Concatenation of All WordsC++Hard
29Divide Two IntegersC++Medium
28Implement strStr()C++, JavaEasy
27Remove ElementC++Easy
26Remove Duplicates from Sorted ArrayC++, JavaEasy
25Reverse Nodes in k-GroupC++Hard
24Swap Nodes in PairsC++Medium
23Merge k Sorted ListsC++Hard
22Generate ParenthesesC++Medium
21Merge Two Sorted ListsC++Easy
20Valid ParenthesesC++Easy
19Remove Nth Node From End of ListC++, PythonEasy
184SumC++Medium
17Letter Combinations of a Phone NumberC++Medium
163Sum ClosestC++Medium
153SumC++Medium
14Longest Common PrefixC++Easy
13Roman to IntegerC++Easy
12Integer to RomanC++Medium
11Container With Most WaterC++Medium
10Regular Expression MatchingC++Hard
9Palindrome NumberC++, JavaEasy
8String to Integer (atoi)C++Easy
7Reverse IntegerC++Easy
6ZigZag ConversionC++Easy
5Longest Palindromic SubstringC++Medium
4Median of Two Sorted ArraysC++Hard
3Longest Substring Without Repeating CharactersC++Medium
2Add Two NumbersC++Medium
1Two SumC++Easy

LeetCode Shell

#TitleSolutionDifficulty
4Tenth LineBashEasy
3Transpose FileBashMedium
2Valid Phone NumbersBashEasy
1Word FrequencyBashMedium

LintCode

#TitleSolutionDifficulty
1Search in a big sorted arrayJavaMedium
2Search Range in Binary Search TreeJavaMedium