Welcome to the Leetcode-Problems repository! We appreciate your interest in contributing to this project. By following these guidelines, you can help us maintain a high-quality collection of Leetcode solutions. Please take a moment to review this document before making any contributions.
To contribute to the Leetcode-Problems repository, you'll need to follow these initial steps.
- Navigate to the Leetcode-Problems repository.
- Click on the Fork button located at the top right corner of the page.
- Wait for the repository to be forked into your GitHub account.
-
On your forked repository, click on the Code button.
-
Copy the repository URL.
-
Open your terminal or Git client.
-
Navigate to the directory where you want to clone the repository.
-
Run the following command:
git clone <repository-url>
Replace
<repository-url>
with the URL you copied.
Now you have the repository cloned and ready for making contributions.
Follow these guidelines to contribute to the Leetcode-Problems repository.
-
Before making any changes, create a new branch with a descriptive name.
-
Use the following command to create a branch:
git checkout -b branch-name
Replace
branch-name
with a short, meaningful branch name that describes your contribution.
- Inside the repository, navigate to the relevant problem category or create a new one if necessary.
- Create a new directory with the problem name in kebab-case.
- Add the solution file(s) inside the problem directory.
- Include a README.md file in the problem directory, explaining the problem statement, approach, and any additional notes.
- If there are multiple solutions, name them appropriately, e.g.,
solution.md
,cpp-solution.cpp
, etc. - Ensure your code is well-documented and easy to understand.
- Follow the existing code style and conventions used in the repository.
- If possible, include appropriate comments and docstrings to explain the logic and any important details.
- Adhere to the language-specific best practices and guidelines.
- Before committing your changes, test your code locally to ensure it runs correctly.
- Write test cases whenever possible to verify the correctness of your solution.
- Run the existing test suite (if any) to check for any regressions.
- Once you are satisfied with your implementation, commit your changes.
- Use descriptive and concise commit messages.
- Separate logical changes into multiple commits if necessary.
- After
committing your changes, push them to your forked repository. 2. Use the following command to push your changes:
git push origin branch-name
Replace branch-name
with the name of the branch you created earlier.
- Go to the original Leetcode-Problems repository.
- Click on the Pull requests tab.
- Click on the New pull request button.
- Select your forked repository and branch from the dropdowns.
- Provide a descriptive title and include any additional context or information in the comment box.
- Click on the Create pull request button to submit your contribution.
The repository maintainers will review your pull request as soon as possible. Please be patient during this process. They may provide feedback or request changes to ensure the quality and consistency of the repository. Once approved, your contribution will be merged into the main branch.
Please review and adhere to the Code of Conduct when participating in this project.
By contributing to the Leetcode-Problems repository, you agree that your contributions will be licensed under the GNU License.