Skip to content

DanialArab/Python

Repository files navigation

Python

This repo documents my solutions to Leetcode - programming questions, whose categories are described in the following. I wrote my solutions in Python, presented in Jupyter Notebook Leetcode Programming Questions.

Leetcode Problem Categories

  1. String
  2. Array
  3. Matrix
  4. Singly Linked List
  5. Hash Table
  6. Two Pointers
  7. String Matching
  8. Stack
  9. Binary Tree
  10. Greedy
  11. Recursion
  12. Math

1: String

Index Question ID Question title Difficulty level
1 1108 Defanging an IP Address Easy
2 2011 Final Value of Variable After Performing Operations Easy
3 771 Jewels and Stones Easy
4 2114 Maximum Number of Words Found in Sentences Easy
5 1678 Goal Parser Interpretation Easy
6 1221 Split a String in Balanced Strings Easy
7 1528 Shuffle String Easy
8 1773 Count Items Matching a Rule Easy
9 2194 Cells in a Range on an Excel Sheet Easy
10 2325 Decode the Message Easy
11 1859 Sorting the Sentence Easy
12 1662 Check If Two String Arrays are Equivalent Easy
13 1832 Check if the Sentence Is Pangram Easy
14 1816 Truncate Sentence Easy
15 1768 Merge Strings Alternately Easy
16 804 Unique Morse Code Words Easy
17 709 To Lower Case Easy
18 1684 Count the Number of Consistent Strings Easy
19 1614 Maximum Nesting Depth of the Parentheses Easy
20 2315 Count Asterisks Easy
21 557 Reverse Words in a String III Easy
22 2103 Rings and Rods Easy
23 2697 Lexicographically Smallest Palindrome Easy
24 1021 Remove Outermost Parentheses Easy
25 1309 Decrypt String from Alphabet to Integer Mapping Easy
26 2000 Reverse Prefix of Word Easy
27 2678 Number of Senior Citizens Easy
28 1704 Determine if String Halves Are Alike Easy
29 1812 Determine Color of a Chessboard Square Easy
30 942 DI String Match Easy
31 2185 Counting Words With a Given Prefix Easy
32 344 Reverse String Easy
33 2586 Count the Number of Vowel Strings in Range Easy
34 1332 Remove Palindromic Subsequences Easy
35 657 Robot Return to Origin Easy
36 944 Delete Columns to Make Sorted Easy
37 2351 First Letter to Appear Twice Easy
38 2278 Percentage of Letter in String Easy
39 1880 Check if Word Equals Summation of Two Words Easy
40 1974 Minimum Time to Type Word Using Special Typewriter Easy
41 2255 Count Prefixes of a Given String Easy
42 2053 Kth Distinct String in an Array Easy
43 2496 Maximum Value of a String in an Array Easy
44 1876 Substrings of Size Three with Distinct Characters Easy
45 821 Shortest Distance to a Character Easy
46 2399 Check Distances Between Same Letters Easy
47 412 Fizz Buzz Easy
48 2506 Count Pairs Of Similar Strings Easy
49 2085 Count Common Words With One Occurrence Easy
50 500 Keyboard Row Easy
51 2309 Greatest English Letter in Upper and Lower Case Easy
52 1160 Find Words That Can Be Formed by Characters Easy
53 929 Unique Email Addresses Easy
54 806 Number of Lines To Write String Easy
55 2243 Calculate Digit Sum of a String Easy
56 2138 Divide a String Into Groups of Size k Easy
57 2224 Minimum Number of Operations to Convert Time Easy
58 1598 Crawler Log Folder Easy
59 1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence Easy
60 2068 Check Whether Two Strings are Almost Equivalent Easy
61 2490 Circular Sentence Easy
62 2710 Remove Trailing Zeros From a String Easy
63 1078 Occurrences After Bigram Easy
64 1507 Reformat Date Easy
65 383 Ransom Note Easy
66 389 Find the Difference Easy
67 2264 Largest 3-Same-Digit Number in String Easy
68 2451 Odd String Difference Easy
69 748 Shortest Completing Word Easy
70 2129 Capitalize the Title Easy
71 599 Minimum Index Sum of Two Lists Easy
72 819 Most Common Word Easy
73 1689 Partitioning Into Minimum Number Of Deci-Binary Numbers Medium
74 535 Encode and Decode TinyURL Medium
75 1769 Minimum Number of Operations to Move All Balls to Each Box Medium
76 2391 Minimum Amount of Time to Collect Garbage Medium
77 2120 Execution of All Suffix Instructions Staying in a Grid Medium
78 2125 Number of Laser Beams in a Bank Medium
79 434 Number of Segments in a String Easy
80 1805 Number of Different Integers in a String Easy
81 2062 Count Vowel Substrings of a String Easy
82 917 Reverse Only Letters Easy
83 171 Excel Sheet Column Number Easy
84 1945 Sum of Digits of String After Convert Easy
85 1763 Longest Nice Substring Easy
86 541 Reverse String II Easy
87 1119 Remove Vowels from a String Easy
88 2744 Find Maximum Number of String Pairs Easy
89 760 Find Anagram Mappings Easy
90 1213 Intersection of Three Sorted Arrays Easy
91 1725 Number Of Rectangles That Can Form The Largest Square Easy
92 1796 Second Largest Digit in a String Easy
93 2716 Minimize String Length Easy
94 2828 Check if a String Is an Acronym of Words Easy
95 2810 Faulty Keyboard Easy
96 1370 Increasing Decreasing String Easy
97 2788 Split Strings by Separator Easy
98 2696 Minimum String Length After Removing Substrings Easy
99 1065 Index Pairs of a String Easy

2. Array

Index Question ID Question title Difficulty level
1 1920 Build Array from Permutation Easy
2 1929 Concatenation of Array Easy
3 1470 Shuffle the Array Easy
4 1512 Number of Good Pairs Easy
5 2574 Left and Right Sum Differences Easy
6 2656 Maximum Sum With Exactly K Elements Easy
7 2652 Sum Multiples Easy
8 1913 Maximum Product Difference Between Two Pairs Easy
9 561 Array Partition Easy
10 1304 Find N Unique Integers Sum up to Zero Easy
11 1464 Maximum Product of Two Elements in an Array Easy
12 2500 Delete Greatest Value in Each Row Easy
13 2176 Count Equal and Divisible Pairs in an Array Easy
14 2553 Separate the Digits in an Array Easy
15 2535 Difference Between Element Sum and Digit Sum of an Array Easy
16 1588 Sum of All Odd Length Subarrays Easy
17 1 Two Sum Easy
18 2303 Calculate Amount Paid in Taxes Easy
19 2078 Two Furthest Houses With Different Colors Easy
20 575 Distribute Candies Easy
21 2728 Count Houses in a Circular Street Easy

3. Matrix

Index Question ID Question title Difficulty level
1 1672 Richest Customer Wealth Easy
2 2373 Largest Local Values in a Matrix Easy
3 1351 Count Negative Numbers in a Sorted Matrix Easy
4 2643 Row With Maximum Ones Easy
5 1337 The K Weakest Rows in a Matrix Easy
6 883 Projection Area of 3D Shapes Easy
7 1380 Lucky Numbers in a Matrix Easy
8 463 Island Perimeter Easy
9 1030 Matrix Cells in Distance Order Easy
10 766 Toeplitz Matrix Easy
11 999 Available Captures for Rook Easy
12 1260 Shift 2D Grid Easy
13 2319 Check if Matrix Is X-Matrix Easy
14 2639 Find the Width of Columns of a Grid Easy
15 1582 Special Positions in a Binary Matrix Easy
16 867 Transpose Matrix Easy
17 892 Surface Area of 3D Shapes Easy
18 1886 Determine Whether Matrix Can Be Obtained By Rotation Easy
19 661 Image Smoother Easy
20 1275 Find Winner on a Tic Tac Toe Game Easy

4. Singly Linked List

Index Question ID Question title Difficulty level
1 1290 Convert Binary Number in a Linked List to Integer Easy
2 876 Middle of the Linked List Easy
3 206 Reverse Linked List Easy
4 2341 Maximum Number of Pairs in Array Easy
5 705 Design HashSet Easy
6 706 Design HashMap Easy
7 21 Merge Two Sorted Lists Easy
8 160 Intersection of Two Linked Lists Easy
9 1474 Delete N Nodes After M Nodes of a Linked List Easy

5. Hash Table

Index Question ID Question title Difficulty level
1 2367 Number of Arithmetic Triplets Easy
2 2215 Find the Difference of Two Arrays Easy
3 1748 Sum of Unique Elements Easy
4 961 N-Repeated Element in Size 2N Array Easy
5 2341 Maximum Number of Pairs in Array Easy
6 2363 Merge Similar Items Easy
7 2032 Two Out of Three Easy
8 2418 Sort the People Easy
9 1436 Destination City Easy
10 1941 Check if All Characters Have Equal Number of Occurrences Easy
11 1742 Maximum Number of Balls in a Box Easy
12 1935 Maximum Number of Words You Can Type Easy
13 2006 Count Number of Pairs With Absolute Difference K Easy
14 1365 How Many Numbers Are Smaller Than the Current Number Easy
15 2670 Find the Distinct Difference Array Easy
16 1207 Unique Number of Occurrences Easy
17 2206 Divide Array Into Equal Pairs Easy
18 2570 Merge Two 2D Arrays by Summing Values Easy
19 1122 Relative Sort Array Easy
20 387 First Unique Character in a String Easy
21 1496 Path Crossing Easy
22 290 Word Pattern Easy
23 141 Linked List Cycle Easy
24 2357 Make Array Zero by Subtracting Equal Amounts Easy
25 1002 Find Common Characters Easy
26 1394 Find Lucky Integer in an Array Easy
27 1165 Single-Row Keyboard Easy

6. Two Pointers

Easy Difficulty Questions

Index Question ID Question title Difficulty level
1 832 Flipping an Image Easy
2 905 Sort Array By Parity Easy
3 977 Squares of a Sorted Array Easy
4 349 Intersection of Two Arrays Easy
5 922 Sort Array By Parity II Easy
6 2562 Find the Array Concatenation Value Easy
7 2441 Largest Positive Integer That Exists With Its Negative Easy
8 1385 Find the Distance Value Between Two Arrays Easy
9 283 Move Zeroes Easy
10 2465 Number of Distinct Averages Easy
11 202 Happy Number Easy
12 2540 Minimum Common Value Easy
13 345 Reverse Vowels of a String Easy

7. String Matching

Index Question ID Question title Difficulty level
1 1408 String Matching in an Array Easy
2 796 Rotate String Easy
3 459 Repeated Substring Pattern Easy
4 28 Find the Index of the First Occurrence in a String Easy
5 1668 Maximum Repeating Substring Easy

8. Stack

Index Question ID Question title Difficulty level
1 590 N-ary Tree Postorder Traversal Easy
2 1475 Final Prices With a Special Discount in a Shop Easy
3 682 Baseball Game Easy
4 496 Next Greater Element I Easy

9. Binary Tree

Index Question ID Question title Difficulty level
1 938 Range Sum of BST Easy
2 2236 Root Equals Sum of Children Easy

10. Greedy

Index Question ID Question title Difficulty level
1 1827 Minimum Operations to Make the Array Increasing Easy
2 860 Lemonade Change Easy
3 1903 Largest Odd Number in String Easy
4 680 Valid Palindrome II Easy
5 2591 Distribute Money to Maximum Children Easy
6 2600 K Items With the Maximum Sum Easy

11. Recursion

Index Question ID Question title Difficulty level
1 509 Fibonacci Number Easy
2 342 Power of Four Easy
3 231 Power of Two Easy
4 326 Power of Three Easy
5 1265 Print Immutable Linked List in Reverse Medium

12. Math

Index Question ID Question title Difficulty level
1 2469 Convert the Temperature Easy
2 2235 Add Two Integers Easy
3 2413 Smallest Even Multiple Easy
4 2769 Find the Maximum Achievable Number Easy
5 2160 Minimum Sum of Four Digit Number After Splitting Digits Easy
6 2520 Count the Digits That Divide a Number Easy
7 2651 Calculate Delayed Arrival Time Easy
8 1863 Sum of All Subset XOR Totals Easy
9 2485 Find the Pivot Integer Easy
10 1180 Count Substrings with Only One Distinct Letter Easy
11 1266 Minimum Time Visiting All Points Easy
12 2427 Number of Common Factors Easy
13 1134 Armstrong Number Easy
14 1252 Cells with Odd Values in a Matrix Easy
15 1688 Count of Matches in Tournament Easy
16 728 Self Dividing Numbers Easy
17 1837 Sum of Digits in Base K Easy
18 1085 Sum of Digits in the Minimum Number Easy
19 2169 Count Operations to Obtain Zero Easy
20 1217 Minimum Cost to Move Chips to The Same Position Easy
21 2578 Split With Minimum Sum Easy
22 2544 Alternating Digit Sum Easy
23 762 Prime Number of Set Bits in Binary Representation Easy
24 258 Add Digits Easy
25 1025 Divisor Game Easy
26 1925 Count Square Sum Triples Easy
27 1716 Calculate Money in Leetcode Bank Easy
28 268 Missing Number Easy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published