Python solutions of problems from LeetCode.
    |
    |
    |
    |
---|---|---|---|
273 | 205 | 15 | 493 |
0001 - 0250 | 1001 - 1250 | 2001 - 2250 | 3001 - 3250 |
0251 - 0500 | 1251 - 1500 | 2251 - 2500 | 3251 - 3500 |
0501 - 0750 | 1501 - 1750 | 2501 - 2750 | 3501 - 3750 |
0751 - 1000 | 1751 - 2000 | 2751 - 3000 |
Num | Task name | Difficulty | Code |
---|---|---|---|
0001 |
Two Sum | </code> | |
0002 |
Add Two Numbers | </code> | |
0003 |
Longest Substring Without Repeating Characters | </code> | |
0004 |
Median of Two Sorted Arrays | </code> | |
0006 |
Zigzag Conversion | </code> | |
0007 |
Reverse Integer | </code> | |
0009 |
Palindrome Number | </code> | |
0011 |
Container With Most Water | </code> | |
0012 |
Integer to Roman | </code> | |
0013 |
Roman to Integer | </code> | |
0014 |
Longest Common Prefix | </code> | |
0017 |
Letter Combinations of a Phone Number | </code> | |
0020 |
Valid Parentheses | </code> | |
0021 |
Merge Two Sorted Lists | </code> | |
0023 |
Merge k Sorted Lists | </code> | |
0024 |
Swap Nodes in Pairs | </code> | |
0026 |
Remove Duplicates from Sorted Array | </code> | |
0027 |
Remove Element | </code> | |
0028 |
Find the Index of the First Occurrence in a String | </code> | |
0032 |
Longest Valid Parentheses | </code> | |
0033 |
Search in Rotated Sorted Array | </code> | |
0034 |
Find First and Last Position of Element in Sorted Array | </code> | |
0035 |
Search Insert Position | </code> | |
0036 |
Valid Sudoku | </code> | |
0041 |
First Missing Positive | </code> | |
0043 |
Multiply Strings | </code> | |
0046 |
Permutations | </code> | |
0047 |
Permutations II | </code> | |
0048 |
Rotate Image | </code> | |
0049 |
Group Anagrams | </code> | |
0050 |
Pow(x, n) | </code> | |
0051 |
N-Queens | </code> | |
0052 |
N-Queens II | </code> | |
0054 |
Spiral Matrix | </code> | |
0058 |
Length of Last Word | </code> | |
0059 |
Spiral Matrix II | </code> | |
0061 |
Rotate List | </code> | |
0062 |
Unique Paths | </code> | |
0063 |
Unique Paths II | </code> | |
0064 |
Minimum Path Sum | </code> | |
0065 |
Valid Number | </code> | |
0066 |
Plus One | </code> | |
0067 |
Add Binary | </code> | |
0068 |
Text Justification | </code> | |
0069 |
Sqrt(x) | </code> | |
0070 |
Climbing Stairs | </code> | |
0072 |
Edit Distance | </code> | |
0074 |
Search a 2D Matrix | </code> | |
0075 |
Sort Colors | </code> | |
0077 |
Combinations | </code> | |
0081 |
Search in Rotated Sorted Array II | </code> | |
0083 |
Remove Duplicates from Sorted List | </code> | |
0091 |
Decode Ways | </code> | |
0094 |
Binary Tree Inorder Traversal | </code> | |
0100 |
Same Tree | </code> | |
0104 |
Maximum Depth of Binary Tree | </code> | |
0118 |
Pascal's Triangle | </code> | |
0119 |
Pascal's Triangle II | </code> | |
0121 |
Best Time to Buy and Sell Stock | </code> | |
0125 |
Valid Palindrome | </code> | |
0136 |
Single Number | </code> | |
0137 |
Single Number II | </code> | |
0139 |
Word Break | </code> | |
0141 |
Linked List Cycle | </code> | |
0150 |
Evaluate Reverse Polish Notation | </code> | |
0151 |
Reverse Words in a String | </code> | |
0155 |
Min Stack | </code> | |
0160 |
Intersection of Two Linked Lists | </code> | |
0162 |
Find Peak Element | </code> | |
0165 |
Compare Version Numbers | </code> | |
0168 |
Excel Sheet Column Title | </code> | |
0169 |
Majority Element | </code> | |
0171 |
Excel Sheet Column Number | </code> | |
0172 |
Factorial Trailing Zeroes | </code> | |
0175 |
Combine Two Tables | </code> | |
0176 |
Second Highest Salary | </code> | |
0179 |
Largest Number | </code> | |
0181 |
Employees Earning More Than Their Managers | </code> | |
0182 |
Duplicate Emails | </code> | |
0183 |
Customers Who Never Order | </code> | |
0189 |
Rotate Array | </code> | |
0190 |
Reverse Bits | </code> | |
0191 |
Number of 1 Bits | </code> | |
0193 |
Valid Phone Numbers | </code> | |
0196 |
Delete Duplicate Emails | </code> | |
0197 |
Rising Temperature | </code> | |
0198 |
House Robber | </code> | |
0199 |
Binary Tree Right Side View | </code> | |
0200 |
Number of Islands | </code> | |
0202 |
Happy Number | </code> | |
0203 |
Remove Linked List Elements | </code> | |
0205 |
Isomorphic Strings | </code> | |
0206 |
Reverse Linked List | </code> | |
0215 |
Kth Largest Element in an Array | </code> | |
0216 |
Combination Sum III | </code> | |
0217 |
Contains Duplicate | </code> | |
0223 |
Rectangle Area | </code> | |
0225 |
Implement Stack using Queues | </code> | |
0228 |
Summary Ranges | </code> | |
0229 |
Majority Element II | </code> | |
0231 |
Power of Two | </code> | |
0232 |
Implement Queue using Stacks | </code> | |
0234 |
Palindrome Linked List | </code> | |
0238 |
Product of Array Except Self | </code> | |
0240 |
Search a 2D Matrix II | </code> | |
0242 |
Valid Anagram | </code> |
Num | Task name | Difficulty | Code |
---|---|---|---|
0258 |
Add Digits | </code> | |
0260 |
Single Number III | </code> | |
0263 |
Ugly Number | </code> | |
0264 |
Ugly Number II | </code> | |
0268 |
Missing Number | </code> | |
0273 |
Integer to English Words | </code> | |
0278 |
First Bad Version | </code> | |
0283 |
Move Zeroes | </code> | |
0287 |
Find the Duplicate Number | </code> | |
0290 |
Word Pattern | </code> | |
0292 |
Nim Game | </code> | |
0299 |
Bulls and Cows | </code> | |
0300 |
Longest Increasing Subsequence | </code> | |
0303 |
Range Sum Query - Immutable | </code> | |
0326 |
Power of Three | </code> | |
0328 |
Odd Even Linked List | </code> | |
0334 |
Increasing Triplet Subsequence | </code> | |
0338 |
Counting Bits | </code> | |
0341 |
Flatten Nested List Iterator | </code> | |
0342 |
Power of Four | </code> | |
0343 |
Integer Break | </code> | |
0344 |
Reverse String | </code> | |
0345 |
Reverse Vowels of a String | </code> | |
0347 |
Top K Frequent Elements | </code> | |
0349 |
Intersection of Two Arrays | </code> | |
0350 |
Intersection of Two Arrays II | </code> | |
0357 |
Count Numbers with Unique Digits | </code> | |
0371 |
Sum of Two Integers | </code> | |
0374 |
Guess Number Higher or Lower | </code> | |
0378 |
Kth Smallest Element in a Sorted Matrix | </code> | |
0380 |
Insert Delete GetRandom O(1) | </code> | |
0383 |
Ransom Note | </code> | |
0387 |
First Unique Character in a String | </code> | |
0389 |
Find the Difference | </code> | |
0392 |
Is Subsequence | </code> | |
0394 |
Decode String | </code> | |
0401 |
Binary Watch | </code> | |
0409 |
Longest Palindrome | </code> | |
0412 |
Fizz Buzz | </code> | |
0415 |
Add Strings | </code> | |
0419 |
Battleships in a Board | </code> | |
0435 |
Non-overlapping Intervals | </code> | |
0442 |
Find All Duplicates in an Array | </code> | |
0443 |
String Compression | </code> | |
0445 |
Add Two Numbers II | </code> | |
0448 |
Find All Numbers Disappeared in an Array | </code> | |
0451 |
Sort Characters By Frequency | </code> | |
0452 |
Minimum Number of Arrows to Burst Balloons | </code> | |
0459 |
Repeated Substring Pattern | </code> |
Num | Task name | Difficulty | Code |
---|---|---|---|
0463 |
Island Perimeter | </code> | |
0468 |
Validate IP Address | </code> | |
0476 |
Number Complement | </code> | |
0482 |
License Key Formatting | </code> | |
0492 |
Construct the Rectangle | </code> | |
0498 |
Diagonal Traverse | </code> | |
0504 |
Base 7 | </code> | |
0506 |
Relative Ranks | </code> | |
0509 |
Fibonacci Number | </code> | |
0511 |
Game Play Analysis I | </code> | |
0515 |
Find Largest Value in Each Tree Row | </code> | |
0518 |
Coin Change II | </code> | |
0541 |
Reverse String II | </code> | |
0547 |
Number of Provinces | </code> | |
0557 |
Reverse Words in a String III | </code> | |
0566 |
Reshape the Matrix | </code> | |
0576 |
Out of Boundary Paths | </code> | |
0584 |
Find Customer Referee | </code> | |
0586 |
Customer Placing the Largest Number of Orders | </code> | |
0592 |
Fraction Addition and Subtraction | </code> | |
0594 |
Longest Harmonious Subsequence | </code> | |
0595 |
Big Countries | </code> | |
0598 |
Range Addition II | </code> | |
0599 |
Minimum Index Sum of Two Lists | </code> | |
0605 |
Can Place Flowers | </code> | |
0606 |
Construct String from Binary Tree | </code> | |
0607 |
Sales Person | </code> | |
0608 |
Tree Node | </code> | |
0610 |
Triangle Judgement | </code> | |
0620 |
Not Boring Movies | </code> | |
0627 |
Swap Salary | </code> | |
0628 |
Maximum Product of Three Numbers | </code> | |
0633 |
Sum of Square Numbers | </code> | |
0645 |
Set Mismatch | </code> | |
0646 |
Maximum Length of Pair Chain | </code> | |
0649 |
Dota2 Senate | </code> | |
0661 |
Image Smoother | </code> | |
0670 |
Maximum Swap | </code> | |
0682 |
Baseball Game | </code> | |
0700 |
Search in a Binary Search Tree | </code> | |
0703 |
Kth Largest Element in a Stream | </code> | |
0706 |
Design HashMap | </code> | |
0710 |
Random Pick with Blacklist | </code> | |
0714 |
Best Time to Buy and Sell Stock with Transaction Fee | </code> | |
0724 |
Find Pivot Index | </code> | |
0728 |
Self Dividing Numbers | </code> |
Num | Task name | Difficulty | Code |
---|---|---|---|
0735 |
Asteroid Collision | </code> | |
0739 |
Daily Temperatures | </code> | |
0746 |
Min Cost Climbing Stairs | </code> | |
0766 |
Toeplitz Matrix | </code> | |
0767 |
Reorganize String | </code> | |
0779 |
K-th Symbol in Grammar | </code> | |
0788 |
Rotated Digits | </code> | |
0790 |
Domino and Tromino Tiling | </code> | |
0791 |
Custom Sort String | </code> | |
0796 |
Rotate String | </code> | |
0806 |
Number of Lines To Write String | </code> | |
0826 |
Most Profit Assigning Work | </code> | |
0830 |
Positions of Large Groups | </code> | |
0832 |
Flipping an Image | </code> | |
0836 |
Rectangle Overlap | </code> | |
0840 |
Magic Squares In Grid | </code> | |
0841 |
Keys and Rooms | </code> | |
0844 |
Backspace String Compare | </code> | |
0852 |
Peak Index in a Mountain Array | </code> | |
0860 |
Lemonade Change | </code> | |
0867 |
Transpose Matrix | </code> | |
0872 |
Leaf-Similar Trees | </code> | |
0875 |
Koko Eating Bananas | </code> | |
0876 |
Middle of the Linked List | </code> | |
0885 |
Spiral Matrix III | </code> | |
0896 |
Monotonic Array | </code> | |
0901 |
Online Stock Span | </code> | |
0905 |
Sort Array By Parity | </code> | |
0914 |
X of a Kind in a Deck of Cards | </code> | |
0921 |
Minimum Add to Make Parentheses Valid | </code> | |
0931 |
Minimum Falling Path Sum | </code> | |
0933 |
Number of Recent Calls | </code> | |
0935 |
Knight Dialer | </code> | |
0938 |
Range Sum of BST | </code> | |
0945 |
Minimum Increment to Make Array Unique | </code> | |
0985 |
Sum of Even Numbers After Queries | </code> |
Num | Task name | Difficulty | Code |
---|---|---|---|
3005 |
Count Elements With Maximum Frequency | </code> | |
3011 |
Find if Array Can Be Sorted | </code> | |
3016 |
Minimum Number of Pushes to Type Word II | </code> | |
3021 |
Alice and Bob Playing Flower Game | </code> | |
3066 |
Minimum Operations to Exceed Threshold Value II | </code> | |
3075 |
Maximize Happiness of Selected Children | </code> | |
3110 |
Score of a String | </code> | |
3120 |
Count the Number of Special Characters I | </code> | |
3136 |
Valid Word | </code> | |
3151 |
Special Array I | </code> | |
3163 |
String Compression III | </code> |
Num | Task name | Difficulty | Code |
---|---|---|---|
3174 |
Clear Digits | </code> | |
3191 |
Minimum Operations to Make Binary Array Elements Equal to One I | </code> | |
3195 |
Find the Minimum Area to Cover All Ones I | </code> | |
3223 |
Minimum Length of String After Operations | </code> | |
3264 |
Final Array State After K Multiplication Operations I | </code> | |
3396 |
Minimum Number of Operations to Make Elements in Array Distinct | </code> | |
3446 |
Sort Matrix by Diagonals | </code> |
Num | Task name | Difficulty | Code |
---|---|---|---|
3516 |
Find Closest Person | </code> |