Welcome to LeetCode-Problems, a structured repository dedicated to solving LeetCode challenges in Python! π§ π‘
This repo is designed to enhance your problem-solving skills through daily coding challenges, complete with clear explanations and well-structured solutions. π―
Each .ipynb file corresponds to a specific day's challenges, focusing on different problem types. The problems include arrays, strings, sorting, searching, dynamic programming, and more!
| Day | Problems Solved | Difficulty Level |
|---|---|---|
| Day 1 | Palindrome Numbers, Two Sum Problem, Roman to Integer | π’ Easy |
| Day 2 | 3Sum | π΅ Medium |
| Day 3 | Merge Strings Alternately, GCD of Strings, Kids With the Greatest Number of Candies | π’ Easy |
| Day 4 | Flower Planting, Move Zeroes, Reverse Words in a String, Product of Array Elements | π‘ Medium |
| Day 6 | Single Number | π’ Easy |
| Day 7 | Can Place Flowers | π’ Easy |
| Day 8 | Reverse Vowels of a String | π‘ Medium |
| Day 9 | Product of Array Except Self | π΅ Medium |
| Day 10 | Find the Highest Altitude | π’ Easy |
Check if an integer is a palindrome.
def isPalindrome(x):
new = str(x)
return new == new[::-1]
print(isPalindrome(-121)) # Output: FalseFind two numbers in an array that add up to a given target.
def twoSum(nums, target):
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return [i, j]
nums = [1, 2, 3]
target = 3
print(twoSum(nums, target)) # Output: [0, 1]Reverse the order of words in a sentence.
def reverse_words(string):
return ' '.join(string.strip().split()[::-1])
s = "a good example"
print(reverse_words(s)) # Output: "example good a"- πΉ π’ Easy β Beginner-friendly problems that cover fundamental concepts.
- πΉ π‘ Medium β Intermediate problems that require deeper thought and optimization.
- πΉ π΅ Hard β Advanced problems that demand strong problem-solving and algorithmic skills.
1οΈβ£ Clone the repository:
git clone https://github.com/your-username/LeetCode-Problems.git2οΈβ£ Navigate to the project folder:
cd LeetCode-Problems3οΈβ£ Open any .ipynb file in Jupyter Notebook or use Python to run .py files.
- π More explanations for problems.
- β‘ Optimized solutions for better efficiency.
- π₯ Additional LeetCode problems added regularly.
- π― Categorization by topics like DP, Graphs, Sorting, etc.
Want to improve the repository? Submit a pull request or fork the repo and add new solutions! Contributions are welcome. π
This project is open-source and free to use. Happy coding! π»π