Thank you for your interest in contributing to this repository! 🎯
This repository is focused on LeetCode problem solving, Data Structures & Algorithms, coding patterns, and interview preparation.
Contributions are welcome if they improve the quality, clarity, organization, or learning value of the repository.
You can contribute in several ways:
- Add a new LeetCode solution
- Improve an existing solution
- Add a better or more efficient approach
- Fix bugs or incorrect solutions
- Improve explanations
- Add time and space complexity analysis
- Add DSA notes
- Add useful problem-solving patterns
- Improve documentation
- Fix spelling, formatting, or broken links
Before contributing, please follow the existing repository structure.
leetcode/
│
├── LeetCode-Solutions/
│ ├── Easy/
│ ├── Medium/
│ └── Hard/
│
├── Questions/
│ ├── Easy/
│ ├── Medium/
│ └── Hard/
│
├── Topics/
│
├── Patterns/
│
├── Notes/
│
├── README.md
├── ROADMAP.md
├── PROGRESS.md
├── CONTRIBUTING.md
├── LICENSE
└── .gitignore
When adding a solution, place it in the appropriate difficulty folder.
For example:
LeetCode-Solutions/
└── Easy/
└── 0001-two-sum/
├── solution.py
└── README.md
Use the following naming convention:
problem-number-problem-name
Example:
0001-two-sum
0013-roman-to-integer
0020-valid-parentheses
Each solution should preferably contain:
- Problem name
- Problem number
- Problem link
- Approach
- Algorithm
- Time complexity
- Space complexity
- Implementation
Example:
# Two Sum
**LeetCode:** #1
## Problem
Given an array of integers `nums` and an integer `target`,
return indices of the two numbers such that they add up to target.
## Approach
Use a hash map to store previously visited numbers and their indices.
For every element, calculate:
complement = target - nums[i]
If the complement already exists in the hash map, return its index
and the current index.
## Complexity
- Time: O(n)
- Space: O(n)
## Solution
```python
class Solution:
def twoSum(self, nums, target):
seen = {}
for i, num in enumerate(nums):
complement = target - num
if complement in seen:
return [seen[complement], i]
seen[num] = i
---
## 🔀 Multiple Approaches
If a problem has multiple important approaches, contributors are encouraged to include them.
For example:
```text
Approach 1 → Brute Force
Approach 2 → Hash Map
Approach 3 → Sorting + Two Pointers
Clearly mention which approach is more efficient.
Every solution should include complexity analysis whenever possible.
Use the standard format:
Time Complexity: O(n)
Space Complexity: O(n)
Avoid adding incorrect or unnecessary complexity claims.
Please make sure your code is:
- Easy to understand
- Properly formatted
- Free from unnecessary code
- Properly indented
- Consistent with the language style
- Tested before submission
Avoid:
# unnecessary comments everywhere
# duplicate code
# unused variablesPrefer clean and readable implementations.
Solutions can be contributed in commonly used programming languages, including:
- Python
- C++
- Java
- JavaScript
- TypeScript
- C
When possible, use the language's standard conventions.
If you find a problem, please open a GitHub Issue.
Useful issues include:
- Incorrect solution
- Wrong complexity analysis
- Broken link
- Typographical error
- Missing explanation
- Poorly formatted code
- Incorrect problem categorization
When reporting an issue, provide enough information to reproduce or understand the problem.
Follow these steps:
Create your own fork of the repository.
git clone https://github.com/Ronit049/Leetcode.gitUse a meaningful branch name:
git checkout -b add-two-sum-solutionOther examples:
fix-roman-to-integer
add-array-notes
improve-sliding-window
update-readme
Add or modify the required files.
Make sure the solution works correctly before submitting.
Use a clear commit message:
git add .
git commit -m "Add Two Sum solution"git push origin add-two-sum-solutionCreate a Pull Request from your branch to the main branch.
Before submitting a Pull Request, make sure:
- The solution is correct
- The code has been tested
- The correct difficulty folder is used
- The problem number and name are correct
- The explanation is clear
- Time complexity is included
- Space complexity is included
- No unnecessary files are included
- Code follows the repository structure
- Commit messages are clear
Please avoid submitting:
- Plagiarized solutions without meaningful contribution
- Unrelated projects
- Executable or binary files
- API keys or passwords
.envfiles containing secrets- Personal information
- Malicious code
- Unnecessary dependencies
Never commit secrets or API keys to this repository.
All contributors are expected to be respectful and constructive.
Please:
- Be respectful to other contributors
- Give constructive feedback
- Help others learn
- Avoid offensive or inappropriate content
- Respect different approaches and programming styles
The goal of this repository is to learn, practice, and improve together.
If you have an idea that could improve the repository, feel free to open an Issue and describe:
- What you want to improve
- Why it would be useful
- How you think it could be implemented
If you find this repository useful:
- ⭐ Star the repository
- 🍴 Fork it
- 🐛 Report issues
- 💡 Suggest improvements
- 🤝 Contribute solutions
Every contribution helps make this repository better for DSA and interview preparation.
By contributing to this repository, you agree that your contributions will be licensed under the repository's MIT License.
See the LICENSE file for more information.
Ronit Raj
GitHub: @Ronit049
Thank you for contributing! 🚀
Happy Coding & Keep Solving! 💻