Skip to content

Solution to LeetCode Problems in Python 🎯

License

Notifications You must be signed in to change notification settings

MozLNMIIT/LeetCode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode License Languages

If you ❤️ this project, please leave me a star ⭐, and contribute to the project by forking the Repository.

About Author
  • I am Pre-Final year student from LNMIIT Jaipur
  • Looking for Job Opportunities 🏢
  • Can be reached out at, 📧 : [email protected]

Solution to LeetCode Problems in Python

ALGORITHMS

S.No. Title Solutions Time Space Difficulty Related Topics
1 Two Sum Solution ⭐ O(n) O(n) Easy Array, Hash Table
2 Add Two Numbers Solution O(n) O(1) Medium Linked List, Math
3 Longest Substring Without Repeating Characters Solution ⭐ O(n) O(n) Medium Hash Table, Two Pointers, String
7 Reverse Integer Solution ⭐ O(n) O(1) Easy Math
9 Palindrome Number Solution O(1) O(1) Easy Math
11 Container With Most Water Solution ⭐ O(n) O(1) Medium Array, Two Pointers
12 Integer to Roman Solution ⭐ O(1) O(1) Medium Math, String
13 Roman to Integer Solution ⭐ O(n) O(1) Medium Math, String
14 Longest Common Prefix Solution O(n^2) O(1) Easy String
19 Remove Nth Node From End of List Solution O(n) O(1) Medium Linked List, Two Pointers
20 Valid Parentheses Solution O(n) O(n) Easy String, Stack
21 Merge Two Sorted Lists Solution O(n) O(n) Easy Linked List
24 Swap Nodes in Pairs Solution O(n) O(1) Medium Linked List
25 Reverse Nodes in k-Group Solution O(n) O(1) Hard Linked List
26 Remove Duplicates from Sorted Array Solution O(n) O(1) Easy Array, Two Pointers
27 Remove Element Solution O(n) O(1) Easy Array, Two Pointers
35 Search Insert Position Solution O(n) O(1) Easy Array, Binary Search
43 Multiply Strings Solution O(1) O(1) Medium Math, String
50 Pow(x,n) Solution O(logn) O(1) Medium Math, Binary Search
53 Maximum Subarray Solution O(n) O(1) Easy Array, Divide and Conquer, Dynamic Programming
61 Plus One Solution O(n) O(1) Easy Array, Math
65 Valid Number Solution O(1) O(1) Hard Math, String
73 Set Matrix Zeroes Solution O(n^2) O(1) Medium Array
78 Subsets Solution O(n^2) O(n^2) Medium Array, Backtracking, Bit Manipulation
83 Remove Duplicates from Sorted List Solution O(n) O(1) Easy Linked List
89 Gray Code Solution O(n^2) O(n) Medium Backtracking
118 Pascal's Triangle Solution O(n^2) O(1) Easy Array
119 Pascal's Triangle II Solution O(n^2) O(k) Easy Array
121 Best Time to Buy and Sell Stock Solution O(n) O(1) Easy Array, Dynamic Programming
125 Valid Palindrome Solution O(1) O(1) Easy Two Pointers, String
136 Single Number Solution O(n) O(1) Easy Hash Table, Bit Manipulation
141 Linked List Cycle Solution O(n) O(1) Easy Linked List, Two Pointers
142 Linked List Cycle II Solution O(n) O(n) Medium Linked List, Two Pointers
160 Intersection of Two Linked Lists Solution O(n) O(n) Easy Linked List
167 Two Sum II - Input array is sorted Solution O(n) O(1) Easy Array, Two Pointers, Binary Search
169 Majority Element Solution O(n) O(1) Easy Array, Divide and Conquer, Bit Manipulation
172 Factorial Trailing Zeroes Solution O(n) O(1) Easy Math
189 Rotate Array Solution O(1) O(1) Easy Array
203 Remove Linked List Elements Solution O(n) O(1) Easy Linked List
204 Count Primes Solution O(n) O(n) Easy Hash Table, Math
206 Reverse Linked List Solution O(n) O(n) Easy Linked List
217 Contains Duplicate Solution O(n) O(n) Easy Array, Hash Table
219 Contains Duplicate II Solution O(n) O(n) Easy Array, Hash Table
231 Power of Two Solution O(1) O(1) Easy Math, Bit Manipulation
234 Palindrome Linked List Solution O(n) O(n) Easy Linked List, Two Pointers
237 Delete Node in a Linked List Solution O(1) O(1) Easy Linked List
242 Valid Anagram Solution O(n) O(n) Easy Hash Table, Sort
268 Missing Number Solution O(n) O(1) Easy Array, Math, Bit Manipulation
283 Move Zeroes Solution O(n) O(1) Easy Array, Two Pointers
287 Find the Duplicate Number Solution O(nlogn) O(1) Easy Array, Two Pointers, Binary Search
326 Power of Three Solution O(logn) O(1) Easy Math
328 Odd Even Linked List Solution O(n) O(1) Medium Linked List
344 Reverse String Solution O(1) O(1) Easy String, Two Pointer
345 Reverse Vowels of a String Solution O(n) O(1) Easy Two Pointers, String
367 Valid Perfect Square Solution O(n) O(1) Easy Math, Binary Search
389 Find the Difference Solution O(n) O(1) Easy Hash Table, Bit Manipulation
441 Arranging Coins Solution O(1) O(1) Easy Math, Binary Search
445 Add Two Numbers II Solution O(n) O(n) Medium Linked List
448 Find All Numbers Disappeared in an Array Solution O(n) O(n) Easy Array
461 Hamming Distance Solution O(n) O(1) Easy Bit Manipulation
476 Number Complement Solution O(n) O(n) Easy Bit Manipulation
485 Max Consecutive Ones Solution O(n) O(1) Easy Array
507 Perfect Number Solution O(logn) O(1) Easy Math
535 Encode and Decode TinyURL Solution O(1) O(1) Medium Hash Table, Math
557 Reverse Words in a String Solution O(n) O(1) Easy String
561 Array Partition I Solution O(n) O(1) Easy Array
566 Reshape the Matrix Solution O(n) O(n^2) Easy Array
599 Minimum Index Sum of Two Lists Solution O(n) O(n) Easy Hash Table
628 Maximum Product of Three Numbers Solution O(nlogn) O(1) Easy Array, Math
633 Sum of Square Numbers Solution O(logn) O(1) Easy Math
645 Set Mismatch Solution O(1) O(n) Easy Hash Table, Math
693 Binary Number with Alternating Bits Solution O(n) O(1) Easy Bit Manipulation
697 Degree of an Array Solution O(n) O(n) Easy Array
804 Unique Morse Code Words Solution O(n^2) O(n) Easy String
832 Flipping an Image Solution O(n^2) O(1) Easy Array
896 Monotonic Array Solution O(n) O(1) Easy Array
929 Unique Email Addresses Solution O(n) O(n) Easy String

DATABASE

S.No. Title Solutions Difficulty
595 Big Countries Solution Easy

About

Solution to LeetCode Problems in Python 🎯

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published