Skip to content

🎓Leetcode solutions in Python 📚

License

Notifications You must be signed in to change notification settings

arhaiyun/Leetcode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language Update Progress License Sponsors

Python solution for Leetcode

Python solution of problems from LeetCode.

# Title Solution
1 Suffix Array Python
2 Longest Common Prefix Python

LeetCode Algorithm

# Title Solution Difficulty
1296 Divide Array in Sets of K Consecutive Numbers Python Medium
1295 Find Numbers with Even Number of Digits Python Easy
1291 Sequential Digits Python Medium
1290 Convert Binary Number in a Linked List to Integer Python Easy
1283 Find the Smallest Divisor Given a Threshold Python Medium
1282 Group the People Given the Group Size They Belong To Python Medium
1281 Subtract the Product and Sum of Digits of an Integer Python Easy
1277 Count Square Submatrices with All Ones Python Medium
1276 Number of Burgers with No Waste of Ingredients Python Medium
1275 Find Winner on a Tic Tac Toe Game Python Easy
1268 Search Suggestions System Python Medium
1267 Count Servers that Communicate Python Medium
1266 Minimum Time Visiting All Points Python Easy
1200 Minimum Absolute Difference Python Easy
# Title Solution Difficulty
1191 K-Concatenation Maximum Sum Python Medium
1190 Reverse Substrings Between Each Pair of Parentheses Python Medium
1189 Maximum Number of Balloons Python Easy
1186 Maximum Subarray Sum with One Deletion Python Medium
1185 Day of the Week Python Easy
1184 Distance Between Bus Stops Python Easy
# Title Solution Difficulty
1092 Shortest Common Supersequence Python Hard
1091 Shortest Path in Binary Matrix Python Medium
1090 Largest Values From Labels Python Medium
1089 Duplicate Zeros Python Easy
1088 Confusing Number II Python Hard
1087 Brace Expansion Python Medium
1086 High Five Python Medium
1085 Sum of Digits in the Minimum Number Python Medium
1081 Smallest Subsequence of Distinct Characters Python Medium
1080 Insufficient Nodes in Root to Leaf Paths Python Medium
1079 Letter Tile Possibilities Python Medium
1078 Occurrences After Bigram Python Easy
1074 Number of Submatrices That Sum to Target Python Hard
1073 Adding Two Negabinary Numbers Python Medium
1072 Flip Columns For Maximum Number of Equal Rows Python Medium
1071 Greatest Common Divisor of Strings Python Easy
1065 Index Pairs of a String Python Easy
1064 Fixed Point Python Easy
1054 Distant Barcodes Python Medium
1053 Previous Permutation With One Swap Python Medium
1052 Grumpy Bookstore Owner Python Medium
1051 Height Checker Python Easy
1048 Longest String Chain Python Medium
1047 Remove All Adjacent Duplicates In String Python Easy
1046 Last Stone Weight Python Easy
1044 Longest Duplicate Substring Python Hard
1043 Partition Array for Maximum Sum Python Medium
1042 Flower Planting With No Adjacent Python Easy
1041 Robot Bounded In Circle Python Easy
1039 Minimum Score Triangulation of Polygon Python Medium
1038 Binary Search Tree to Greater Sum Tree Python Medium
1037 Valid Boomerang Python Easy
1035 Uncrossed Lines Python Medium
1034 Coloring A Border Python Medium
1033 Moving Stones Until Consecutive Python Easy
1032 Stream of Characters Python Hard
1031 Maximum Sum of Two Non-Overlapping Subarrays Python Medium
1030 Matrix Cells in Distance Order Python Easy
1029 Two City Scheduling Python Easy
1028 Recover a Tree From Preorder Traversal Python Hard
1027 Longest Arithmetic Sequence Python Medium
1026 Maximum Difference Between Node and Ancestor Python Medium
1025 Divisor Game Python Easy
1023 Camelcase Matching Python Medium
1022 Sum of Root To Leaf Binary Numbers Python Easy
1021 Remove Outermost Parentheses Python Easy
1020 Number of Enclaves Python Medium
1019 Next Greater Node In Linked List Python Medium
1018 Binary Prefix Divisible By 5 Python Easy
1017 Convert to Base -2 Python Medium
1016 Binary String With Substrings Representing 1 To N Python Medium
1015 Smallest Integer Divisible by K Python Medium
1014 Best Sightseeing Pair Python Medium
1013 Partition Array Into Three Parts With Equal Sum Python Easy
1011 Capacity To Ship Packages Within D Days Python Medium
1010 Pairs of Songs With Total Durations Divisible by 60 Python Easy
1009 Complement of Base 10 Integer Python Easy
1008 Construct Binary Search Tree from Preorder Traversal Python Medium
1007 Minimum Domino Rotations For Equal Row Python Medium
1006 Clumsy Factorial Python Medium
1005 Maximize Sum Of Array After K Negations Python Easy
1004 Max Consecutive Ones III Python Medium
1003 Check If Word Is Valid After Substitutions Python Medium
1002 Find Common Characters Python Easy
# Title Solution Difficulty
999 Available Captures for Rook Python Medium
998 Maximum Binary Tree II Python Easy
997 Find the Town Judge Python Easy
995 Minimum Number of K Consecutive Bit Flips Python Hard
994 Rotting Oranges Python Easy
993 Cousins in Binary Tree Python Easy
991 Broken Calculator Python Medium
990 Satisfiability of Equality Equations Python Medium
989 Add to Array-Form of Integer Python Easy
988 Smallest String Starting From Leaf Python Medium
985 Sum of Even Numbers After Queries Python Easy
984 String Without AAA or BBB Python Easy
983 Minimum Cost For Tickets Python Medium
981 Time Based Key-Value Store Python Medium
977 Squares of a Sorted Array Python Easy
926 Flip String to Monotone Increasing Python Medium
# Title Solution Difficulty
681 Next Closest Time Python Medium
674 Longest Continuous Increasing Subsequence Python Easy
673 Number of Longest Increasing Subsequence Python Medium
# Title Solution Difficulty
482 License Key Formatting Python Easy
454 4Sum II Python Medium
448 Find All Numbers Disappeared in an Array Python Easy
442 Find All Duplicates in an Array Python Easy
418 Sentence Screen Fitting Python Medium
410 Split Array Largest Sum Python Hard
# Title Solution Difficulty
393 UTF-8 Validation Python Medium
388 Longest Absolute File Path Python Medium
387 First Unique Character in a String Python Easy
380 Insert Delete GetRandom O(1) Python Hard
378 Kth Smallest Element in a Sorted Matrix Python Medium
361 Bomb Enemy Python Medium
350 Intersection of Two Arrays II Python Easy
347 Top K Frequent Elements Python Medium
346 Moving Average from Data Stream Python Easy
340 Longest Substring with At Most K Distinct Characters Python Hard
334 Increasing Triplet Subsequence Python Medium
332 Reconstruct Itinerary Python Medium
329 Longest Increasing Path in a Matrix Python Medium
328 Odd Even Linked List Python Easy
326 Power of Three Python Easy
322 Coin Change Python Medium
315 Count of Smaller Numbers After Self Python Hard
307 Range Sum Query - Mutable Python Medium
301 Remove Invalid Parentheses Python Hard
# Title Solution Difficulty
300 Longest Increasing Subsequence Python Medium
298 Binary Tree Longest Consecutive Sequence Python Medium
297 Serialize and Deserialize Binary Tree Python Hard
295 Find Median from Data Stream Python Hard
289 Game of Life Python Medium
287 Find the Duplicate Number Python Hard
285 Inorder Successor in BST Python Medium
283 Move Zeros Python Easy
281 Zigzag Iterator Python Medium
279 Perfect Squares Python Medium
268 Missing Number Python Easy
257 Binary Tree Paths Python Easy
253 Meeting Rooms II Python Medium
240 Search a 2D Matrix II Python Medium
239 Sliding Window Maximum Python Hard
238 Product of Array Except Self Python Medium
236 Lowest Common Ancestor of a Binary Tree Python Medium
235 Lowest Common Ancestor of a Binary Search Tree Python Easy
234 Palindrome Linked List Python Easy
230 Kth Smallest Element in a BST Python Medium
226 Invert Binary Tree Python Easy
215 Kth Largest Element in an Array Python Medium
210 Course Schedule II Python Medium
208 Implement Trie (Prefix Tree) Python Medium
207 Course Schedule Python Medium
206 Reverse Linked List Python Easy
203 Remove Linked List Elements Python Easy
200 Number of Islands Python Medium
# Title Solution Difficulty
199 Binary Tree Right Side View Python Medium
191 Number of 1 Bits Python Easy
179 Largest Number Python Medium
173 Binary Search Tree Iterator Python Medium
170 Two Sum III - Data structure design Python Easy
163 Missing RangesPython Medium
162 Find Peak Element Python Medium
160 Intersection of Two Linked Lists Python Easy
159 Longest Substring Which Contains 2 Unique Characters Python Hard
155 Min Stack Python Easy
152 Maximum Product Subarray Python Medium
150 Evaluate Reverse Polish Notation Python Medium
148 Sort List Python Medium
147 Insertion Sort List Python Medium
146 LRU Cache Python Hard
145 Binary Tree Postorder Traversal Python Hard
144 Binary Tree Preorder Traversal Python Medium
143 Reorder List Python Medium
142 Linked List Cycle II Python Medium
141 Linked List Cycle Python Medium
139 Word Break Python Medium
134 Gas Station Python Medium
132 Palindrome Partitioning II Python Hard
131 Palindrome Partitioning Python Medium
130 Surrounded Regions Python Medium
129 Sum Root to Leaf Numbers Python Medium
128 Longest Consecutive Sequence Python Hard
127 Word Ladder Python Medium
125 Valid Palindrome Python Easy
123 Best Time to Buy and Sell Stock III Python Hard
120 Triangle Python Medium
119 Pascal's Triangle II Python Easy
118 Pascal's Triangle Python Easy
117 Populating Next Right Pointers in Each Node II Python Hard
116 Populating Next Right Pointers in Each Node Python Medium
115 Distinct Subsequences Python Hard
113 Path Sum II Python Medium
112 Path Sum Python Easy
111 Minimum Depth of Binary Tree Python Easy
108 Convert Sorted Array to Binary Search Tree Python Easy
107 Binary Tree Level Order Traversal II Python Easy
106 Construct Binary Tree from Inorder and Postorder Traversal Python Medium
105 Construct Binary Tree from Preorder and Inorder Traversal Python Medium
103 Binary Tree Zigzag Level Order Traversal Python Medium
102 Binary Tree Level Order Traversal Python Easy
101 Symmetric Tree Python Easy
100 Same Tree Python Easy
# Title Solution Difficulty
99 Recover Binary Search Tree Python Hard
98 Validate Binary Search Tree Python Medium
97 Interleaving String Python Hard
95 Unique Binary Search Trees II Python Medium
94 Binary Tree Inorder Traversal Python Medium
93 Restore IP Addresses Python Medium
92 Reverse Linked List II Python Medium
91 Decode Ways Python Medium
90 Subsets II Python Medium
87 Scramble String Python Hard
86 Partition List Python Medium
85 Maximal Rectangle Python Hard
83 Remove Duplicates from Sorted List Python Easy
82 Remove Duplicates from Sorted List II Python Medium
81 Search in Rotated Sorted Array II Python Medium
80 Remove Duplicates from Sorted Array II Python Medium
79 Word Search Python Medium
78 Subsets Python Medium
75 Sort Colors Python Medium
74 Search a 2D Matrix Python Medium
73 Set Matrix Zeroes Python Medium
72 Edit Distance Python Hard
71 Simplify Path Python Medium
70 Climbing Stairs Python Easy
67 Add Binary Python Easy
66 Plus One Python Easy
65 Valid Number Python Easy
64 Minimum Path Sum Python Medium
63 Unique Paths II Python Medium
62 Unique Paths Python Medium
61 Rotate List Python Medium
60 Permutation Sequence Python Medium
57 Insert Interval Python Hard
56 Merge Intervals Python Hard
54 Spiral Matrix Python Medium
53 Maximum Subarray Python Medium
48 Rotate Image Python Medium
46 Permutations Python Medium
45 Jump Game II Python Hard
44 Wildcard Matching Python Hard
42 Trapping Rain Water Python Hard
41 First Missing Positive Python Hard
40 Combination Sum II Python Medium
39 Combination Sum Python Medium
38 Count and Say Python Easy
36 Valid Sudoku Python Medium
34 Search for a Range Python Medium
33 Search in Rotated Sorted Array Python Hard
32 Longest Valid Parentheses Python Hard
31 Next Permutation Python Medium
30 Substring with Concatenation of All Words Python Hard
26 Remove Duplicates from Sorted Array Python Easy
25 Reverse Nodes in k-Group Python Hard
24 Swap Nodes in Pairs Python Medium
23 Merge k Sorted Lists Python Hard
22 Generate Parentheses Python Medium
19 Remove Nth Node From End of List Python Easy
18 4Sum Python Medium
17 Letter Combinations of a Phone Number Python Medium
16 3Sum Closest Python Medium
15 3Sum Python Medium
14 Longest Common Prefix Python Easy
11 Container With Most Water Python Medium
10 Regular Expression Matching Python Hard
6 ZigZag Conversion Python Easy
5 Longest Palindromic Substring Python Medium
4 Median of Two Sorted Arrays Python Hard
3 Longest Substring Without Repeating Characters Python Medium
1 Two Sum Python Medium

About

🎓Leetcode solutions in Python 📚

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%