README_EN.md

September 13, 2020 · View on GitHub

| English | 简体中文 |

My LeetCode Solutions


Last updated: 2020-09-13 13:18:38

The source code is fetched using the tool LeetCode_Helper.

#TitleSolutionsAcceptanceDifficultyTags
LCP 18早餐组合Python320.8%easy
LCP 17速算机器人Python385.0%easy
LCP 20快速公交Python316.7%hard
面试题 17.13Re-Space LCCIPython356.2%mediumMemoization
String
面试题 16.11Diving Board LCCIPython344.4%easyRecursion
Memoization
剑指 Offer 56 - I数组中数字出现的次数 LCOFPython371.0%medium
剑指 Offer 20表示数值的字符串 LCOFPython323.1%mediumMath
剑指 Offer 11旋转数组的最小数字 LCOFPython349.5%easyBinary Search
面试题 16.04Tic-Tac-Toe LCCIPython343.8%mediumArray
面试题 08.03Magic Index LCCIPython368.2%easyArray
Binary Search
LCP 01Guess NumbersPython383.9%easy
5513Min Cost to Connect All PointsPython338.6%mediumUnion Find
5512Count Unhappy FriendsPython348.8%mediumArray
5511Special Positions in a Binary MatrixPython365.2%easyArray
1567Maximum Length of Subarray With Positive ProductPython333.1%mediumGreedy
1566Detect Pattern of Length M Repeated K or More TimesPython342.8%easyArray
1563Stone Game VPython337.2%hardDynamic Programming
1562Find Latest Group of Size MPython329.1%mediumBinary Search
1561Maximum Number of Coins You Can GetPython380.5%mediumSort
1560Most Visited Sector in a Circular TrackPython357.1%easyArray
1545Find Kth Bit in Nth Binary StringPython354.4%mediumString
1544Make The String GreatPython346.7%easyStack
String
1559Detect Cycles in 2D GridPython333.5%hardDepth-first Search
1558Minimum Numbers of Function Calls to Make Target ArrayPython361.2%mediumGreedy
1557Minimum Number of Vertices to Reach All NodesPython373.6%mediumGraph
1556Thousand SeparatorPython361.1%easyString
1537Get the Maximum ScorePython334.6%hardDynamic Programming
1535Find the Winner of an Array GamePython343.5%mediumArray
1534Count Good TripletsPython378.5%easyArray
1546Maximum Number of Non-Overlapping Subarrays With Sum Equals TargetPython338.2%mediumDynamic Programming
1541Minimum Insertions to Balance a Parentheses StringPython341.0%mediumStack
String
1540Can Convert String in K MovesPython328.6%mediumGreedy
String
1539Kth Missing Positive NumberPython354.1%easyArray
Hash Table
1519Number of Nodes in the Sub-Tree With the Same LabelPython326.9%mediumDepth-first Search
Breadth-first Search
1396Design Underground SystemPython344.5%mediumDesign
1374Generate a String With Characters That Have Odd CountsPython372.8%easyString
1298Maximum Candies You Can Get from BoxesPython358.4%hardBreadth-first Search
1249Minimum Remove to Make Valid ParenthesesPython356.6%mediumStack
String
1131Maximum of Absolute Value ExpressionPython342.6%mediumBit Manipulation
Math
1128Number of Equivalent Domino PairsPython345.8%easyArray
1122Relative Sort ArrayGo
Python3
66.7%easySort
Array
1109Corporate Flight BookingsGo
Python3
47.3%mediumArray
Math
1108Defanging an IP AddressGo
Python3
83.2%easyString
1114Print in OrderPython363.7%easy
1106Parsing A Boolean ExpressionGo
Python3
55.2%hardString
1103Distribute Candies to PeopleGo
Python3
63.2%easyMath
1094Car PoolingGo
Python3
59.4%mediumGreedy
1093Statistics from a Large SampleGo
Python3
41.5%mediumMath
Two Pointers
1089Duplicate ZerosGo
Python3
57.2%easyArray
1079Letter Tile PossibilitiesGo
Python3
73.2%mediumBacktracking
1081Smallest Subsequence of Distinct CharactersGo
Python3
51.2%mediumString
1080Insufficient Nodes in Root to Leaf PathsGo
Python3
47.6%mediumDepth-first Search
1078Occurrences After BigramGo
Python3
61.7%easyHash Table
1073Adding Two Negabinary NumbersGo
Python3
31.8%mediumMath
1072Flip Columns For Maximum Number of Equal RowsGo
Python3
54.0%mediumHash Table
1071Greatest Common Divisor of StringsGo
Python3
58.7%easyString
1054Distant BarcodesPython335.0%mediumHeap
Sort
1053Previous Permutation With One SwapPython343.8%mediumGreedy
Array
1052Grumpy Bookstore OwnerPython349.8%mediumArray
Sliding Window
1051Height CheckerPython373.5%easyArray
1049Last Stone Weight IIPython347.6%mediumDynamic Programming
1048Longest String ChainPython343.0%mediumHash Table
Dynamic Programming
1047Remove All Adjacent Duplicates In StringPython368.5%easyStack
1046Last Stone WeightPython361.3%easyHeap
Greedy
1044Longest Duplicate SubstringPython320.6%hardHash Table
Binary Search
1043Partition Array for Maximum SumPython365.9%mediumGraph
1042Flower Planting With No AdjacentPython351.1%easyGraph
1041Robot Bounded In CirclePython344.8%mediumMath
1037Valid BoomerangPython343.3%easyMath
1038Binary Search Tree to Greater Sum TreePython376.7%mediumBinary Search Tree
1040Moving Stones Until Consecutive IIPython349.6%mediumArray
Sliding Window
1039Minimum Score Triangulation of PolygonPython353.3%mediumDynamic Programming
1035Uncrossed LinesPython354.5%mediumArray
1031Maximum Sum of Two Non-Overlapping SubarraysPython353.9%mediumArray
1025Divisor GamePython371.6%easyMath
Dynamic Programming
1056Confusing Number🔒Python337.2%easyMath
1060Missing Element in Sorted Array🔒Python350.6%mediumBinary Search
1061Lexicographically Smallest Equivalent String🔒Python354.8%mediumDepth-first Search
Union Find
1058Minimize Rounding Error to Meet Target🔒Python331.4%mediumGreedy
Math
Dynamic Programming
1057Campus Bikes🔒Python342.2%mediumGreedy
Sort
978Longest Turbulent SubarrayPython342.1%mediumArray
Dynamic Programming
Sliding Window
931Minimum Falling Path SumPython361.6%mediumDynamic Programming
905Sort Array By ParityPython369.2%easyArray
889Construct Binary Tree from Preorder and Postorder TraversalPython366.1%mediumTree
887Super Egg DropPython328.6%hardMath
Binary Search
Dynamic Programming
867Transpose MatrixPython67.8%easyArray
851Loud and RichPython344.7%mediumDepth-first Search
849Maximize Distance to Closest PersonPython41.0%mediumArray
841Keys and RoomsPython365.4%mediumDepth-first Search
Graph
840Magic Squares In GridPython34.8%mediumArray
641Design Circular DequePython353.2%mediumDesign
Queue
830Positions of Large GroupsPython47.5%easyArray
825Friends Of Appropriate AgesPython35.9%mediumArray
811Subdomain Visit CountPython368.4%easyHash Table
805Split Array With Same AveragePython326.9%hardMath
792Number of Matching SubsequencesPython42.7%mediumArray
779K-th Symbol in GrammarPython342.7%mediumRecursion
775Global and Local InversionsPython44.3%mediumArray
Math
701Insert into a Binary Search TreePython372.5%mediumTree
766Toeplitz MatrixPython66.5%easyArray
429N-ary Tree Level Order TraversalPython366.5%mediumTree
Breadth-first Search
747Largest Number At Least Twice of OthersPython39.8%easyArray
746Min Cost Climbing StairsPython49.7%easyArray
Dynamic Programming
739Daily TemperaturesPython364.6%mediumStack
Hash Table
724Find Pivot IndexPython38.5%easyArray
718Maximum Length of Repeated SubarrayPython354.2%mediumArray
Hash Table
Binary Search
Dynamic Programming
7171-bit and 2-bit CharactersPython49.3%easyArray
713Subarray Product Less Than KPython36.6%mediumArray
Two Pointers
698Partition to K Equal Sum SubsetsPython343.2%mediumRecursion
Dynamic Programming
697Degree of an ArrayPython54.5%easyArray
696Count Binary SubstringsPython362.3%easyString
695Max Area of IslandPython63.9%mediumDepth-first Search
Array
674Longest Continuous Increasing SubsequencePython45.2%easyArray
670Maximum SwapPython41.5%mediumArray
Math
667Beautiful Arrangement IIPython361.2%mediumArray
665Non-decreasing ArrayPython22.7%easyArray
661Image SmootherPython54.2%easyArray
657Robot Return to OriginPython377.8%easyString
649Dota2 SenatePython338.6%mediumGreedy
647Palindromic SubstringsPython364.6%mediumString
Dynamic Programming
643Maximum Average Subarray IPython39.1%easyArray
637Average of Levels in Binary TreePython368.7%easyTree
628Maximum Product of Three NumbersPython50.5%easyArray
Math
621Task SchedulerPython350.8%mediumGreedy
Queue
Array
617Merge Two Binary TreesPython377.2%easyTree
611Valid Triangle NumberPython348.9%mediumArray
605Can Place FlowersPython32.1%easyArray
581Shortest Unsorted Continuous SubarrayPython35.0%easyArray
566Reshape the MatrixPython65.1%easyArray
565Array NestingPython359.0%mediumArray
561Array Partition IPython72.0%easyArray
560Subarray Sum Equals KPython45.0%mediumArray
Hash Table
557Reverse Words in a String IIIPython3
Python3
73.4%easyString
546Remove BoxesPython364.5%hardDepth-first Search
Dynamic Programming
543Diameter of Binary TreePython351.6%easyTree
538Convert BST to Greater TreePython363.3%easyTree
532K-diff Pairs in an ArrayPython34.8%easyArray
Two Pointers
529MinesweeperPython365.5%mediumDepth-first Search
Breadth-first Search
1059All Paths from Source Lead to Destination🔒Python332.2%mediumDepth-first Search
Graph
508Most Frequent Subtree SumPython365.0%mediumTree
Hash Table
498Diagonal TraversePython342.1%medium
495Teemo AttackingPython53.4%mediumArray
494Target SumPython344.4%mediumDepth-first Search
Dynamic Programming
491Increasing SubsequencesPython356.0%mediumDepth-first Search
486Predict the WinnerPython358.8%mediumMinimax
Dynamic Programming
485Max Consecutive OnesPython56.7%easyArray
480Sliding Window MedianPython335.6%hardSliding Window
461Hamming DistancePython377.6%easyBit Manipulation
459Repeated Substring PatternPython3
Python3
51.4%easyString
4544Sum IIPython356.1%mediumHash Table
Binary Search
448Find All Numbers Disappeared in an ArrayPython60.1%easyArray
442Find All Duplicates in an ArrayPython67.2%mediumArray
438Find All Anagrams in a StringPython346.5%mediumHash Table
416Partition Equal Subset SumGo
Python3
49.3%mediumDynamic Programming
414Third Maximum NumberPython35.4%easyArray
406Queue Reconstruction by HeightPython367.1%mediumGreedy
401Binary WatchPython352.6%easyBit Manipulation
Backtracking
392Is SubsequencePython350.5%easyGreedy
Binary Search
Dynamic Programming
387First Unique Character in a StringPython346.9%easyHash Table
String
384Shuffle an ArrayPython353.5%medium
380Insert Delete GetRandom O(1)Python
Python3
49.0%mediumDesign
Array
Hash Table
350Intersection of Two Arrays IIPython352.8%easySort
Hash Table
Two Pointers
Binary Search
347Top K Frequent ElementsPython361.7%mediumHeap
Hash Table
344Reverse StringPython371.7%easyTwo Pointers
String
343Integer BreakPython358.7%mediumMath
Dynamic Programming
337House Robber IIIPython360.2%mediumTree
Depth-first Search
336Palindrome PairsPython339.6%hardTrie
Hash Table
String
334Increasing Triplet SubsequencePython339.1%medium
332Reconstruct ItineraryPython343.9%mediumDepth-first Search
Graph
309Best Time to Buy and Sell Stock with CooldownPython357.2%mediumDynamic Programming
299Bulls and CowsPython348.5%easyHash Table
292Nim GamePython369.3%easyBrainteaser
Minimax
287Find the Duplicate NumberPython65.9%mediumArray
Two Pointers
Binary Search
283Move ZeroesPython
Python3
62.3%easyArray
Two Pointers
268Missing NumberPython57.0%easyBit Manipulation
Array
Math
257Binary Tree PathsPython366.0%easyTree
Depth-first Search
242Valid AnagramPython361.3%easySort
Hash Table
240Search a 2D Matrix IIPython342.1%mediumBinary Search
Divide and Conquer
238Product of Array Except SelfPython
Python3
70.8%mediumArray
237Delete Node in a Linked ListPython382.9%easyLinked List
236Lowest Common Ancestor of a Binary TreePython365.3%mediumTree
235Lowest Common Ancestor of a Binary Search TreePython365.0%easyTree
231Power of TwoPython348.6%easyBit Manipulation
Math
230Kth Smallest Element in a BSTPython371.8%mediumTree
Binary Search
228Summary RangesPython53.5%mediumArray
219Contains Duplicate IIPython40.3%easyArray
Hash Table
217Contains DuplicatePython
Python3
53.0%easyArray
Hash Table
216Combination Sum IIIPython
Python3
73.7%mediumArray
Backtracking
215Kth Largest Element in an ArrayGo
Python3
64.4%mediumHeap
Divide and Conquer
207Course SchedulePython354.2%mediumDepth-first Search
Breadth-first Search
Graph
Topological Sort
206Reverse Linked ListPython370.5%easyLinked List
201Bitwise AND of Numbers RangePython351.2%mediumBit Manipulation
189Rotate ArrayPython
Python3
43.0%easyArray
171Excel Sheet Column NumberPython368.1%easyMath
169Majority ElementPython
Python3
64.5%easyBit Manipulation
Array
Divide and Conquer
167Two Sum II - Input array is sortedPython
Python3
56.6%easyArray
Two Pointers
Binary Search
162Find Peak ElementPython47.4%mediumArray
Binary Search
155Min StackGo
Python3
55.3%easyStack
Design
153Find Minimum in Rotated Sorted ArrayPython51.6%mediumArray
Binary Search
152Maximum Product SubarrayPython
Python3
40.3%mediumArray
Dynamic Programming
146LRU CacheGo
Python3
50.7%mediumDesign
141Linked List CyclePython49.3%easyLinked List
Two Pointers
136Single NumberPython
Python3
69.8%easyBit Manipulation
Hash Table
133Clone GraphPython364.7%mediumDepth-first Search
Breadth-first Search
Graph
130Surrounded RegionsPython342.2%mediumDepth-first Search
Breadth-first Search
Union Find
125Valid PalindromePython346.3%easyTwo Pointers
String
122Best Time to Buy and Sell Stock IIPython63.0%easyGreedy
Array
121Best Time to Buy and Sell StockPython54.9%easyArray
Dynamic Programming
120TrianglePython
Python3
66.7%mediumArray
Dynamic Programming
119Pascal's Triangle IIPython61.9%easyArray
118Pascal's TrianglePython67.4%easyArray
114Flatten Binary Tree to Linked ListPython371.1%mediumTree
Depth-first Search
112Path SumPython351.1%easyTree
Depth-first Search
111Minimum Depth of Binary TreePython344.3%easyTree
Depth-first Search
Breadth-first Search
110Balanced Binary TreePython354.6%easyTree
Depth-first Search
109Convert Sorted List to Binary Search TreePython376.1%mediumDepth-first Search
Linked List
107Binary Tree Level Order Traversal IIPython367.6%easyTree
Breadth-first Search
104Maximum Depth of Binary TreePython375.0%easyTree
Depth-first Search
100Same TreePython360.2%easyTree
Depth-first Search
99Recover Binary Search TreePython362.1%hardTree
Depth-first Search
96Unique Binary Search TreesPython369.1%mediumTree
Dynamic Programming
95Unique Binary Search Trees IIPython366.7%mediumTree
Dynamic Programming
93Restore IP AddressesPython349.8%mediumString
Backtracking
91Decode WaysPython324.5%mediumString
Dynamic Programming
90Subsets IIPython60.8%mediumArray
Backtracking
89Gray CodePython368.8%mediumBacktracking
88Merge Sorted ArrayPython
Python3
48.6%easyArray
Two Pointers
81Search in Rotated Sorted Array IIPython35.8%mediumArray
Binary Search
80Remove Duplicates from Sorted Array IIPython356.4%mediumArray
Two Pointers
78SubsetsPython77.9%mediumBit Manipulation
Array
Backtracking
77CombinationsPython3
Python3
75.7%mediumBacktracking
75Sort ColorsPython55.4%mediumSort
Array
Two Pointers
74Search a 2D MatrixPython338.9%mediumArray
Binary Search
73Set Matrix ZeroesPython355.8%mediumArray
71Simplify PathPython340.6%mediumStack
String
70Climbing StairsPython350.6%easyDynamic Programming
69Sqrt(x)Go
Python3
38.9%easyMath
Binary Search
66Plus OnePython45.4%easyArray
64Minimum Path SumPython367.5%mediumArray
Dynamic Programming
63Unique Paths IIPython336.7%mediumArray
Dynamic Programming
62Unique PathsPython362.1%mediumArray
Dynamic Programming
61Rotate ListPython340.5%mediumLinked List
Two Pointers
60Permutation SequencePython3
Python3
51.4%mediumMath
Backtracking
59Spiral Matrix IIPython78.1%mediumArray
58Length of Last WordPython333.7%easyString
56Merge IntervalsPython343.0%mediumSort
Array
55Jump GamePython341.0%mediumGreedy
Array
54Spiral MatrixPython41.2%mediumArray
53Maximum SubarrayPython52.3%easyArray
Divide and Conquer
Dynamic Programming
51N-QueensPython373.0%hardBacktracking
50Pow(x, n)Python336.6%mediumMath
Binary Search
49Group AnagramsPython363.4%mediumHash Table
String
48Rotate ImagePython69.6%mediumArray
47Permutations IIPython359.9%mediumBacktracking
46PermutationsPython376.8%mediumBacktracking
45Jump Game IIPython337.6%hardGreedy
Array
44Wildcard MatchingPython331.3%hardGreedy
String
Dynamic Programming
Backtracking
43Multiply StringsPython3
Python3
44.5%mediumMath
String
42Trapping Rain WaterPython352.6%hardStack
Array
Two Pointers
41First Missing PositivePython340.2%hardArray
40Combination Sum IIPython
Python3
64.5%mediumArray
Backtracking
39Combination SumPython
Python3
71.4%mediumArray
Backtracking
38Count and SayPython356.4%easyString
37Sudoku SolverPython362.7%hardHash Table
Backtracking
36Valid SudokuPython360.8%mediumHash Table
35Search Insert PositionPython46.7%easyArray
Binary Search
34Find First and Last Position of Element in Sorted ArrayPython340.3%mediumArray
Binary Search
33Search in Rotated Sorted ArrayPython338.9%mediumArray
Binary Search
31Next PermutationPython34.5%mediumArray
29Divide Two IntegersPython320.1%mediumMath
Binary Search
28Implement strStr()Python339.7%easyTwo Pointers
String
27Remove ElementPython58.8%easyArray
Two Pointers
26Remove Duplicates from Sorted ArrayPython51.7%easyArray
Two Pointers
25Reverse Nodes in k-GroupPython363.0%hardLinked List
24Swap Nodes in PairsPython366.7%mediumLinked List
23Merge k Sorted ListsPython353.1%hardHeap
Linked List
Divide and Conquer
22Generate ParenthesesPython376.2%mediumString
Backtracking
21Merge Two Sorted ListsPython364.3%easyLinked List
20Valid ParenthesesPython343.0%easyStack
String
19Remove Nth Node From End of ListPython339.4%mediumLinked List
Two Pointers
184SumPython38.4%mediumArray
Hash Table
Two Pointers
17Letter Combinations of a Phone NumberPython3
Python3
55.5%mediumString
Backtracking
163Sum ClosestPython345.8%mediumArray
Two Pointers
153SumPython29.4%mediumArray
Two Pointers
14Longest Common PrefixPython338.7%easyString
13Roman to IntegerPython362.1%easyMath
String
12Integer to RomanPython364.3%mediumMath
String
11Container With Most WaterPython364.2%mediumArray
Two Pointers
9Palindrome NumberPython358.5%easyMath
8String to Integer (atoi)Python321.0%mediumMath
String
7Reverse IntegerPython334.7%easyMath
6ZigZag ConversionPython348.7%mediumString
5Longest Palindromic SubstringGo
Python3
31.8%mediumString
Dynamic Programming
4Median of Two Sorted ArraysGo
Python3
38.7%hardArray
Binary Search
Divide and Conquer
3Longest Substring Without Repeating CharactersGo
Python3
35.6%mediumHash Table
Two Pointers
String
Sliding Window
2Add Two NumbersGo
Python3
38.2%mediumLinked List
Math
1Two SumGo
Python
Python3
49.4%easyArray
Hash Table