Skip to content

🎓Leetcode solutions in Python 📚

Notifications You must be signed in to change notification settings

Garvit244/Leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LanguageUpdateProgressSponsors

Python solution for Leetcode

Python solution of problems from LeetCode.

#TitleSolution
1Suffix ArrayPython
2Longest Common PrefixPython

LeetCode Algorithm

#TitleSolutionDifficulty
1296Divide Array in Sets of K Consecutive NumbersPythonMedium
1295Find Numbers with Even Number of DigitsPythonEasy
1291Sequential DigitsPythonMedium
1290Convert Binary Number in a Linked List to IntegerPythonEasy
1283Find the Smallest Divisor Given a ThresholdPythonMedium
1282Group the People Given the Group Size They Belong ToPythonMedium
1281Subtract the Product and Sum of Digits of an IntegerPythonEasy
1277Count Square Submatrices with All OnesPythonMedium
1276Number of Burgers with No Waste of IngredientsPythonMedium
1275Find Winner on a Tic Tac Toe GamePythonEasy
1268Search Suggestions SystemPythonMedium
1267Count Servers that CommunicatePythonMedium
1266Minimum Time Visiting All PointsPythonEasy
1200Minimum Absolute DifferencePythonEasy
#TitleSolutionDifficulty
1191K-Concatenation Maximum SumPythonMedium
1190Reverse Substrings Between Each Pair of ParenthesesPythonMedium
1189 Maximum Number of BalloonsPythonEasy
1186Maximum Subarray Sum with One DeletionPythonMedium
1185Day of the WeekPythonEasy
1184Distance Between Bus StopsPythonEasy
#TitleSolutionDifficulty
1092Shortest Common SupersequencePythonHard
1091Shortest Path in Binary MatrixPythonMedium
1090Largest Values From Labels PythonMedium
1089Duplicate ZerosPythonEasy
1088Confusing Number IIPythonHard
1087Brace ExpansionPythonMedium
1086High FivePythonMedium
1085Sum of Digits in the Minimum NumberPythonMedium
1081Smallest Subsequence of Distinct CharactersPythonMedium
1080Insufficient Nodes in Root to Leaf PathsPythonMedium
1079Letter Tile PossibilitiesPythonMedium
1078Occurrences After BigramPythonEasy
1074Number of Submatrices That Sum to TargetPythonHard
1073Adding Two Negabinary NumbersPythonMedium
1072Flip Columns For Maximum Number of Equal RowsPythonMedium
1071Greatest Common Divisor of StringsPythonEasy
1065Index Pairs of a StringPythonEasy
1064Fixed PointPythonEasy
1054Distant BarcodesPythonMedium
1053Previous Permutation With One SwapPythonMedium
1052Grumpy Bookstore OwnerPythonMedium
1051Height CheckerPythonEasy
1048Longest String ChainPythonMedium
1047Remove All Adjacent Duplicates In StringPythonEasy
1046Last Stone WeightPythonEasy
1044Longest Duplicate SubstringPythonHard
1043Partition Array for Maximum SumPythonMedium
1042Flower Planting With No AdjacentPythonEasy
1041Robot Bounded In CirclePythonEasy
1039Minimum Score Triangulation of PolygonPythonMedium
1038Binary Search Tree to Greater Sum TreePythonMedium
1037Valid BoomerangPythonEasy
1035Uncrossed LinesPythonMedium
1034Coloring A BorderPythonMedium
1033Moving Stones Until ConsecutivePythonEasy
1032Stream of CharactersPythonHard
1031Maximum Sum of Two Non-Overlapping SubarraysPythonMedium
1030Matrix Cells in Distance OrderPythonEasy
1029Two City SchedulingPythonEasy
1028Recover a Tree From Preorder TraversalPythonHard
1027Longest Arithmetic SequencePythonMedium
1026Maximum Difference Between Node and AncestorPythonMedium
1025Divisor GamePythonEasy
1023Camelcase MatchingPythonMedium
1022Sum of Root To Leaf Binary NumbersPythonEasy
1021Remove Outermost ParenthesesPythonEasy
1020Number of EnclavesPythonMedium
1019Next Greater Node In Linked ListPythonMedium
1018Binary Prefix Divisible By 5PythonEasy
1017Convert to Base -2PythonMedium
1016Binary String With Substrings Representing 1 To NPythonMedium
1015Smallest Integer Divisible by KPythonMedium
1014Best Sightseeing PairPythonMedium
1013Partition Array Into Three Parts With Equal Sum PythonEasy
1011Capacity To Ship Packages Within D DaysPythonMedium
1010Pairs of Songs With Total Durations Divisible by 60PythonEasy
1009Complement of Base 10 IntegerPythonEasy
1008Construct Binary Search Tree from Preorder TraversalPythonMedium
1007Minimum Domino Rotations For Equal RowPythonMedium
1006Clumsy FactorialPythonMedium
1005Maximize Sum Of Array After K NegationsPythonEasy
1004Max Consecutive Ones IIIPythonMedium
1003Check If Word Is Valid After SubstitutionsPythonMedium
1002Find Common CharactersPythonEasy
#TitleSolutionDifficulty
999Available Captures for RookPythonMedium
998Maximum Binary Tree IIPythonEasy
997Find the Town JudgePythonEasy
995Minimum Number of K Consecutive Bit FlipsPythonHard
994Rotting OrangesPythonEasy
993Cousins in Binary TreePythonEasy
991Broken CalculatorPythonMedium
990Satisfiability of Equality EquationsPythonMedium
989Add to Array-Form of IntegerPythonEasy
988Smallest String Starting From LeafPythonMedium
985Sum of Even Numbers After QueriesPythonEasy
984String Without AAA or BBBPythonEasy
983Minimum Cost For TicketsPythonMedium
981Time Based Key-Value StorePythonMedium
977Squares of a Sorted ArrayPythonEasy
926Flip String to Monotone IncreasingPythonMedium
#TitleSolutionDifficulty
681Next Closest Time PythonMedium
674Longest Continuous Increasing SubsequencePythonEasy
673Number of Longest Increasing SubsequencePythonMedium
#TitleSolutionDifficulty
482License Key FormattingPythonEasy
4544Sum IIPythonMedium
448Find All Numbers Disappeared in an ArrayPythonEasy
442Find All Duplicates in an ArrayPythonEasy
418Sentence Screen FittingPythonMedium
410Split Array Largest SumPythonHard
#TitleSolutionDifficulty
393UTF-8 ValidationPythonMedium
388Longest Absolute File PathPythonMedium
387First Unique Character in a StringPythonEasy
380Insert Delete GetRandom O(1)PythonHard
378Kth Smallest Element in a Sorted MatrixPythonMedium
361Bomb EnemyPythonMedium
350Intersection of Two Arrays IIPythonEasy
347Top K Frequent ElementsPythonMedium
346Moving Average from Data StreamPythonEasy
340Longest Substring with At Most K Distinct CharactersPythonHard
334Increasing Triplet SubsequencePythonMedium
332Reconstruct ItineraryPythonMedium
329Longest Increasing Path in a MatrixPythonMedium
328Odd Even Linked ListPythonEasy
326Power of ThreePythonEasy
322Coin ChangePythonMedium
315Count of Smaller Numbers After SelfPythonHard
307Range Sum Query - MutablePythonMedium
301Remove Invalid ParenthesesPythonHard
#TitleSolutionDifficulty
300Longest Increasing SubsequencePythonMedium
298Binary Tree Longest Consecutive Sequence PythonMedium
297Serialize and Deserialize Binary TreePythonHard
295Find Median from Data StreamPythonHard
289Game of LifePythonMedium
287Find the Duplicate NumberPythonHard
285Inorder Successor in BSTPythonMedium
283Move ZerosPythonEasy
281Zigzag IteratorPythonMedium
279Perfect SquaresPythonMedium
268Missing NumberPythonEasy
257Binary Tree PathsPythonEasy
253Meeting Rooms IIPythonMedium
240Search a 2D Matrix IIPythonMedium
239Sliding Window MaximumPythonHard
238Product of Array Except SelfPythonMedium
236Lowest Common Ancestor of a Binary TreePythonMedium
235Lowest Common Ancestor of a Binary Search TreePythonEasy
234Palindrome Linked ListPythonEasy
230Kth Smallest Element in a BSTPythonMedium
226Invert Binary TreePythonEasy
215Kth Largest Element in an ArrayPythonMedium
210Course Schedule IIPythonMedium
208Implement Trie (Prefix Tree)PythonMedium
207Course SchedulePythonMedium
206Reverse Linked ListPythonEasy
203Remove Linked List ElementsPythonEasy
200Number of IslandsPythonMedium
#TitleSolutionDifficulty
199Binary Tree Right Side ViewPythonMedium
191Number of 1 BitsPythonEasy
179Largest NumberPythonMedium
173Binary Search Tree IteratorPythonMedium
170Two Sum III - Data structure designPythonEasy
163Missing RangesPythonMedium
162Find Peak ElementPythonMedium
160Intersection of Two Linked ListsPythonEasy
159Longest Substring Which Contains 2 Unique CharactersPythonHard
155Min StackPythonEasy
152Maximum Product SubarrayPythonMedium
150Evaluate Reverse Polish NotationPythonMedium
148Sort ListPythonMedium
147Insertion Sort ListPythonMedium
146LRU CachePythonHard
145Binary Tree Postorder TraversalPythonHard
144Binary Tree Preorder TraversalPythonMedium
143Reorder ListPythonMedium
142Linked List Cycle IIPythonMedium
141Linked List CyclePythonMedium
139Word BreakPythonMedium
134Gas StationPythonMedium
132Palindrome Partitioning IIPythonHard
131Palindrome PartitioningPythonMedium
130Surrounded RegionsPythonMedium
129Sum Root to Leaf NumbersPythonMedium
128Longest Consecutive SequencePythonHard
127Word LadderPythonMedium
125Valid PalindromePythonEasy
123Best Time to Buy and Sell Stock IIIPythonHard
120TrianglePythonMedium
119Pascal's Triangle IIPythonEasy
118Pascal's TrianglePythonEasy
117Populating Next Right Pointers in Each Node IIPythonHard
116Populating Next Right Pointers in Each NodePythonMedium
115Distinct SubsequencesPythonHard
113Path Sum IIPythonMedium
112Path SumPythonEasy
111Minimum Depth of Binary TreePythonEasy
108Convert Sorted Array to Binary Search TreePythonEasy
107Binary Tree Level Order Traversal IIPythonEasy
106Construct Binary Tree from Inorder and Postorder TraversalPythonMedium
105Construct Binary Tree from Preorder and Inorder TraversalPythonMedium
103Binary Tree Zigzag Level Order TraversalPythonMedium
102Binary Tree Level Order TraversalPythonEasy
101Symmetric TreePythonEasy
100Same TreePythonEasy
#TitleSolutionDifficulty
99Recover Binary Search TreePythonHard
98Validate Binary Search TreePythonMedium
97Interleaving StringPythonHard
95Unique Binary Search Trees IIPythonMedium
94Binary Tree Inorder TraversalPythonMedium
93Restore IP AddressesPythonMedium
92Reverse Linked List IIPythonMedium
91Decode WaysPythonMedium
90Subsets IIPythonMedium
87Scramble StringPythonHard
86Partition ListPythonMedium
85Maximal RectanglePythonHard
83Remove Duplicates from Sorted ListPythonEasy
82Remove Duplicates from Sorted List IIPythonMedium
81Search in Rotated Sorted Array IIPythonMedium
80Remove Duplicates from Sorted Array IIPythonMedium
79Word SearchPythonMedium
78SubsetsPythonMedium
75Sort ColorsPythonMedium
74Search a 2D MatrixPythonMedium
73Set Matrix ZeroesPythonMedium
72Edit DistancePythonHard
71Simplify PathPythonMedium
70Climbing StairsPythonEasy
67Add BinaryPythonEasy
66Plus OnePythonEasy
65Valid NumberPythonEasy
64Minimum Path SumPythonMedium
63Unique Paths IIPythonMedium
62Unique PathsPythonMedium
61Rotate ListPythonMedium
60Permutation SequencePythonMedium
57Insert IntervalPythonHard
56Merge IntervalsPythonHard
54Spiral MatrixPythonMedium
53Maximum SubarrayPythonMedium
48Rotate ImagePythonMedium
46PermutationsPythonMedium
45Jump Game IIPythonHard
44Wildcard MatchingPythonHard
42Trapping Rain WaterPythonHard
41First Missing PositivePythonHard
40Combination Sum IIPythonMedium
39Combination SumPythonMedium
38Count and SayPythonEasy
36Valid SudokuPythonMedium
34Search for a RangePythonMedium
33Search in Rotated Sorted ArrayPythonHard
32Longest Valid ParenthesesPythonHard
31Next PermutationPythonMedium
30Substring with Concatenation of All WordsPythonHard
26Remove Duplicates from Sorted ArrayPythonEasy
25Reverse Nodes in k-GroupPythonHard
24Swap Nodes in PairsPythonMedium
23Merge k Sorted ListsPythonHard
22Generate ParenthesesPythonMedium
19Remove Nth Node From End of ListPythonEasy
184SumPythonMedium
17Letter Combinations of a Phone NumberPythonMedium
163Sum ClosestPythonMedium
153SumPythonMedium
14Longest Common PrefixPythonEasy
11Container With Most WaterPythonMedium
10Regular Expression MatchingPythonHard
6ZigZag ConversionPythonEasy
5Longest Palindromic SubstringPythonMedium
4Median of Two Sorted ArraysPythonHard
3Longest Substring Without Repeating CharactersPythonMedium
1Two SumPythonMedium
close