/leetcode

Repository containing Python solutions of Leetcode problems.

Primary LanguagePython

Repository containing Python solutions to LeetCode problems. The focal point of this project is to try to provide solutions as minimalist and as clean as possible.

# Title Solution Difficulty
1 Two Sum Python Easy
2 Add Two Numbers Python Medium
3 Longest Substring Without Repeating Characters Python Medium
4 Median of Two Sorted Arrays Python Hard
5 Longest Palindromic Substring Python Medium
6 ZigZag Conversion Python Medium
7 Reverse Integer Python Easy
8 String to Integer (atoi) Python Medium
9 Palindrome Number Python Easy
10 Regular Expression Matching Python Hard
11 Container With Most Water Python Medium
12 Integer to Roman Python Medium
13 Roman to Integer Python Easy
14 Longest Common Prefix Python Easy
16 3Sum Closest Python Medium
17 Letter Combinations of a Phone Number Python Medium
18 4Sum Python Medium
19 Remove Nth Node From End of List Python Medium
20 Valid Parentheses Python Easy
23 Merge k Sorted Lists Python Hard
24 Swap Nodes in Pairs Python Medium
25 Reverse Nodes in k-Group Python Hard
26 Remove Duplicates from Sorted Array Python Easy
27 Remove Element Python Easy
28 Implement strStr() Python Easy
29 Divide Two Integers Python Medium
33 Search in Rotated Sorted Array Python Medium
34 Find First and Last Position of Element in Sorted Array Python Medium
35 Search Insert Position Python Easy
36 Valid Sudoku Python Medium
38 Count and Say Python Medium
39 Combination Sum Python Medium
41 First Missing Positive Python Hard
42 Trapping Rain Water Python Hard
43 Multiply Strings Python Medium
45 Jump Game II Python Medium
48 Rotate Image Python Medium
53 Maximum Subarray Python Easy
54 Spiral Matrix Python Medium
55 Jump Game Python Medium
56 Merge Intervals Python Medium
57 Insert Interval Python Medium
58 Length of Last Word Python Easy
64 Minimum Path Sum Python Medium
66 Plus One Python Easy
67 Add Binary Python Easy
70 Climbing Stairs Python Easy
76 Minimum Window Substring Python Hard
78 Subsets Python Medium
104 Maximum Depth of Binary Tree Python Easy
121 Best Time to Buy and Sell Stock Python Easy
122 Best Time to Buy and Sell Stock II Python Easy
136 Single Number Python Easy
155 Min Stack Python Easy
169 Majority Element Python Easy
179 Largest Number Python Medium
189 Rotate Array Python Medium
202 Happy Number Python Easy
206 Reverse Linked List Python Easy
226 Invert Binary Tree Python Easy
227 Basic Calculator II Python Medium
237 Delete Node in a Linked List Python Easy
279 Perfect Squares Python Medium
283 Move Zeroes Python Easy
303 Range Sum Query - Immutable Python Easy
322 Coin Change Python Medium
338 Counting Bits Python Medium
344 Reverse String Python Easy
347 Top K Frequent Elements Python Medium
405 Convert a Number to Hexadecimal Python Easy
406 Queue Reconstruction by Height Python Medium
478 Generate Random Point in a Circle Python Medium
509 Fibonacci Number Python Easy
516 Longest Palindromic Subsequence Python Medium
581 Shortest Unsorted Continuous Subarray Python Medium
617 Merge Two Binary Trees Python Easy
621 Task Scheduler Python Medium
628 Maximum Product of Three Numbers Python Easy
659 Split Array into Consecutive Subsequences Python Medium
696 Count Binary Substrings Python Easy
697 Degree of an Array Python Easy
709 To Lower Case Python Easy
709 To Lower Case Python Easy
766 Toeplitz Matrix Python Easy
771 Jewels and Stones Python Easy
780 Reaching Points Python Hard
781 Rabbits in Forest Python Medium
783 Minimum Distance Between BST Nodes Python Easy
817 Linked List Components Python Medium
819 Most Common Word Python Easy
840 Magic Squares In Grid Python Medium
841 Keys and Rooms Python Medium
842 Split Array into Fibonacci Sequence Python Medium
859 Buddy Strings Python Easy
867 Transpose Matrix Python Easy
872 Leaf-Similar Trees Python Easy
875 Koko Eating Bananas Python Medium
941 Valid Mountain Array Python Easy
944 Delete Columns to Make Sorted Python Easy
957 Prison Cells After N Days Python Medium
973 K Closest Points to Origin Python Medium
1114 Print in Order Python Easy
1115 Print FooBar Alternately Python Medium
1116 Print Zero Even Odd Python Medium
1195 Fizz Buzz Multithreaded Python Medium
1295 Find Numbers with Even Number of Digits Python Easy
1304 Find N Unique Integers Sum up to Zero Python Easy
1309 Decrypt String from Alphabet to Integer Mapping Python Easy
1342 Number of Steps to Reduce a Number to Zero Python Easy
1366 Rank Teams by Votes Python Medium
1394 Find Lucky Integer in an Array Python Easy
1408 String Matching in an Array Python Easy
1447 Simplified Fractions Python Medium
1448 Count Good Nodes in Binary Tree Python Medium
1449 Form Largest Integer With Digits That Add up to Target Python Hard
1456 Maximum Number of Vowels in a Substring of Given Length Python Medium
1523 Count Odd Numbers in an Interval Range Python Easy
1528 Shuffle String Python Easy

Dataframe & Git Automation

The python file [automation.py] provides a simple way to automatise the generation of 'row' and folder/files to update the repository. For example, if the ids is set to [2, 13], the script will generate the files if they do not exist yet, change the README.md using the source.md, and copy the commit message to the pastebin as follows:

Rows created in the README.md:

|2|[Add Two Numbers](https://leetcode.com/problems/add-two-numbers/)|[Python](./solutions/2-add-two-numbers.py)|Medium|
|13|[Roman to Integer](https://leetcode.com/problems/roman-to-integer/)|[Python](./solutions/13-roman-to-integer.py)|Easy|

Commit information printed and copied into the clipboard (only the last item of the list):

Add 13-roman-to-integer

The automation file also generate a dataframe that summarize all the existing Leetcode questions:

leetcode-dataframe