Skip to content

Latest commit

 

History

113 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode-Solution

Array

ID Title Solution Difficulty
1252 Cells with Odd Values in a Matrix python Easy
1243 Array Transformation python Easy
1196 How Many Apples Can You Put into the Basket python Easy
1228 Missing Number In Arithmetic Progression python Easy
1232 Check If It Is a Straight Line python Easy
905 Sort Array By Parity python Easy
1184 Distance Between Bus Stops python Easy
977 Squares of a Sorted Array python Easy
561 Array Partition I python Easy
922 Sort Array By Parity II python Easy
1229 Meeting Scheduler python Medium
509 Fibonacci Number python Easy
1002 Find Common Characters python Easy
985 Sum of Even Numbers After Queries python Easy
1200 Minimum Absolute Difference python Easy
1051 Height Checker python Easy
888 Fair Candy Swap python Easy
1207 Unique Number of Occurrences python Easy
1013 Partition Array Into Three Parts With Equal Sum python Easy
896 Monotonic Array python Easy
1222 Queens That Can Attack the King python Medium
1089 Duplicate Zeros python Easy
1131 Maximum of Absolute Value Expression python Medium
485 Max Consecutive Ones python Easy
283 Move Zeroes python Easy
457 Circular Array Loop python Medium
448 Find All Numbers Disappeared in an Array python Easy
169 Majority Element python Easy
217 Contains Duplicate python Easy
167 Two Sum II - Input array is sorted python Easy
661 Image Smoother python Easy
830 Positions of Large Groups python Easy
268 Missing Number python Easy
717 1-bit and 2-bit Characters python Easy
697 Degree of an Array python Easy
1010 Pairs of Songs With Total Durations Divisible by 60 python Easy
628 Maximum Product of Three Numbers python Easy
27 Remove Element python Easy
121 Best Time to Buy and Sell Stock python Easy
122 Best Time to Buy and Sell Stock II python Easy
746 Min Cost Climbing Stairs python Easy
1137 N-th Tribonacci Number python Easy
53 Maximum Subarray python Easy
724 Find Pivot Index python Easy
35 Search Insert Position python Easy
1169 Invalid Transactions python Easy
1175 Prime Arrangements python Easy
1176 Diet Plan Performance python Easy
1180 Count Substrings with Only One Distinct Letter python Easy
1181 Before and After Puzzle python Medium
1177 Can Make Palindrome from Substring python Medium
1144 Decrease Elements To Make Array Zigzag python Medium
380 Insert Delete GetRandom O(1) python Medium
1277 Count Square Submatrices with All Ones python Medium
1163 Last Substring in Lexicographical Order python Hard
381 Insert Delete GetRandom O(1) - Duplicates allowed python Hard
986 Interval List Intersections python Medium
1156 Swap For Longest Repeated Character Substring python Medium
769 Max Chunks To Make Sorted python Medium
768 Max Chunks To Make Sorted II python Hard
1139 Largest 1-Bordered Square python Medium
1186 Maximum Subarray Sum with One Deletion python Medium
1191 K-Concatenation Maximum Sum python Medium
1250 Check If It Is a Good Array python Hard
1183 Maximum Number of Ones python Hard
782 Transform to Chessboard python Hard
902 Numbers At Most N Given Digit Set python Hard
1012 Numbers With Repeated Digits python Hard
689 Maximum Sum of 3 Non-Overlapping Subarrays python Hard

LinkedList

Recommend Order ID Title Solution Difficulty
1 # LinkedList Structure python None
2 21 Merge Two Sorted Lists python Easy
3 203 Remove Linked List Elements python Easy
4 83 Remove Duplicates from Sorted List python Easy
5 876 Middle of the Linked List python Easy
6 141 Linked List Cycle python Easy
7 206 Reverse Linked List python Easy
8 234 Palindrome Linked List python Easy
9 707 Design Linked List python Easy
10 1171 Remove Zero Sum Consecutive Nodes from Linked List python Medium
11 86 Partition List python Medium
12 2 Add Two Numbers python Medium
13 19 Remove Nth Node From End of List python Medium
14 24 Swap Nodes in Pairs python Medium
15 328 Odd Even Linked List python Medium
16 109 Convert Sorted List to Binary Search Tree python Medium
17 147 Insertion Sort List python Medium
18 148 Sort List python Medium
19 92 Reverse Linked List II python Medium
20 82 Remove Duplicates from Sorted List II python Medium
21 142 Linked List Cycle II python Medium
22 143 Reorder List python Medium
23 61 Rotate List python Medium
24 25 Reverse Nodes in k-Group python Hard
25 23 Merge k Sorted Lists python Hard
26 382 Linked List Random Node python Medium
27 146 LRU Cache python Medium

String

ID Title Solution Difficulty
1275 Find Winner on a Tic Tac Toe Game python Easy
1271 Hexspeak python Easy
1221 Split a String in Balanced Strings python Easy
972 Equal Rational Numbers python Hard

Math

ID Title Solution Difficulty
1276 Number of Burgers with No Waste of Ingredients python Medium

Stack

ID Title Solution Difficulty
20 Valid Parentheses python Easy
1047 Remove All Adjacent Duplicates In String python Easy
682 Baseball Game python Easy
1021 Remove Outermost Parentheses python Easy
844 Backspace String Compare python Easy
155 Min Stack python Easy
232 Implement Queue using Stacks python Easy
225 Implement Stack using Queues python Easy
496 Next Greater Element I python Easy
1190 Reverse Substrings Between Each Pair of Parentheses python Medium
1249 Minimum Remove to Make Valid Parentheses python Medium
1130 Minimum Cost Tree From Leaf Values python Medium
71 Simplify Path python Medium
1209 Remove All Adjacent Duplicates in String II python Medium

Backtrack

ID Title Solution Difficulty
46 Permutations python Medium
47 Permutations II python Medium
78 Subsets python Medium
90 Subsets II python Medium
39 Combination Sum python Medium
40 Combination Sum II python Medium
216 Combination Sum III python Medium

HashSet

ID Title Solution Difficulty
1213 Intersection of Three Sorted Arrays python Easy

HashMap

ID Title Solution Difficulty
1185 Day of the Week python Easy
1217 Play with Chips python Easy
1189 Maximum Number of Balloons python Easy
1165 Single-Row Keyboard python Easy
1128 Number of Equivalent Domino Pairs python Easy
1247 Minimum Swaps to Make Strings Equal python Easy
1166 Design File System python Medium
930 Binary Subarrays With Sum python Medium
982 Triples with Bitwise AND Equal To Zero python Hard
1138 Alphabet Board Path python Medium
1124 Longest Well-Performing Interval python Medium
1152 Analyze User Website Visit Pattern python Medium
939 Minimum Area Rectangle python Medium
1224 Maximum Equal Frequency python Hard
1153 String Transforms Into Another String python Hard

SlidingWindow

ID Title Solution Difficulty
1248 Count Number of Nice Subarrays python Medium
992 Subarrays with K Different Integers python Hard
1208 Get Equal Substrings Within Budget python Medium
1234 Replace the Substring for Balanced String python Medium

Bitwise

ID Title Solution Difficulty
1238 Circular Permutation in Binary Representation python Medium
1178 Number of Valid Words for Each Puzzle python Hard

Hash

Recommend Order ID Title Solution Difficulty
1 796 Rotate String python Easy
2 686 Repeated String Match python Easy
3 1044 Longest Duplicate Substring python Hard

Tree

ID Title Solution Difficulty
1214 Two Sum BSTs python Medium
1145 Binary Tree Coloring Game python Medium
1123 Lowest Common Ancestor of Deepest Leaves python Medium
1245 Tree Diameter python Medium
1273 Delete Tree Nodes python Medium
87 Scramble String python Hard

Trie

ID Title Solution Difficulty
1233 Remove Sub-Folders from the Filesystem python Medium

Binary Search

ID Title Solution Difficulty
1237 Find Positive Integer Solution for a Given Equation python Easy
1244 Design A Leaderboard python Medium
1146 Snapshot Array python Medium
1170 Compare Strings by Frequency of the Smallest Character python Medium
1182 Shortest Distance to Target Color python Medium
1157 Online Majority Element In Subarray python Hard
81 Search in Rotated Sorted Array II python Medium
1201 Ugly Number III python Medium
1274 Number of Ships in a Rectangle python Hard
154 Find Minimum in Rotated Sorted Array II python Hard
668 Kth Smallest Number in Multiplication Table python Hard
1231 Divide Chocolate python Hard
719 Find K-th Smallest Pair Distance python Hard

Sort

ID Title Solution Difficulty
1272 Remove Interval python Medium
1122 Relative Sort Array python Easy
973 K Closest Points to Origin python Medium

DFS

ID Title Solution Difficulty
1254 Number of Closed Islands python Medium
1219 Path with Maximum Gold python Medium
980 Unique Paths III python Hard

BFS

ID Title Solution Difficulty
1129 Shortest Path with Alternating Colors python Medium
1215 Stepping Numbers python Medium
1162 As Far from Land as Possible python Medium
1197 Minimum Knight Moves python Medium
1210 Minimum Moves to Reach Target with Rotations python Hard
847 Shortest Path Visiting All Nodes python Hard

Greedy

ID Title Solution Difficulty
1253 Reconstruct a 2-Row Binary Matrix python Medium
991 Broken Calculator python Medium
1147 Longest Chunked Palindrome Decomposition python Hard

Union Find

ID Title Solution Difficulty
# DSU Structure python None
1202 Smallest String With Swaps python Medium
947 Most Stones Removed with Same Row or Column python Medium
721 Accounts Merge python Medium
1135 Connecting Cities With Minimum Cost python Medium
1168 Optimize Water Distribution in a Village python Hard
924 Minimize Malware Spread python Hard

Graph

ID Title Solution Difficulty
787 Cheapest Flights Within K Stops python Medium
1136 Parallel Courses python Hard
1203 Sort Items by Groups Respecting Dependencies python Hard
1192 Critical Connections in a Network python Hard

Dynamic Programming

ID Title Solution Difficulty
1218 Longest Arithmetic Subsequence of Given Difference python Medium
1223 Dice Roll Simulation python Medium
1220 Count Vowels Permutation python Hard
1143 Longest Common Subsequence python Medium
931 Minimum Falling Path Sum python Medium
935 Knight Dialer python Medium
983 Minimum Cost For Tickets python Medium
1216 Valid Palindrome III python Hard
795 Number of Subarrays with Bounded Maximum python Medium
115 Distinct Subsequences python Hard
174 Dungeon Game python Hard
1140 Stone Game II python Medium
1000 Minimum Cost to Merge Stones python Hard
300 Longest Increasing Subsequence python Medium
354 Russian Doll Envelopes python Hard
368 Largest Divisible Subset python Medium
967 Numbers With Same Consecutive Differences python Medium
1155 Number of Dice Rolls With Target Sum python Medium
1239 Maximum Length of a Concatenated String with Unique Characters python Medium
1240 Tiling a Rectangle with the Fewest Squares python Hard
403 Frog Jump python Hard
464 Can I Win python Medium
1230 Toss Strange Coins python Medium
375 Guess Number Higher or Lower II python Medium
1235 Maximum Profit in Job Scheduling python Hard
1255 Maximum Score Words Formed by Letters python Hard
1278 Palindrome Partitioning III python Hard
940 Distinct Subsequences II python Hard
871 Minimum Number of Refueling Stops python Hard
1187 Make Array Strictly Increasing python Hard
1246 Palindrome Removal python Hard
188 Best Time to Buy and Sell Stock IV python Hard
956 Tallest Billboard python Hard
1125 Smallest Sufficient Team python Hard

Heap

ID Title Solution Difficulty
1198 Find Smallest Common Element in All Rows python Medium
1167 Minimum Cost to Connect Sticks python Medium
1172 Dinner Plate Stacks python Hard
871 Minimum Number of Refueling Stops python Hard
857 Minimum Cost to Hire K Workers python Hard
786 K-th Smallest Prime Fraction python Hard
1199 Minimum Time to Build Blocks python Hard

About

Leetcode solution for weekly contest

Resources

Stars

16 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages