|
| 1 | +# Contributing to [leetcode](https://github.com/ayusshrathore/leetcode) |
| 2 | + |
| 3 | +Thank you for considering contributing to [Your Repository Name]! We welcome contributions from the community to help improve and grow this project. To get started, please follow the guidelines below. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +- Make sure you have a [GitHub account](https://github.com/signup) if you don't already. |
| 8 | +- Fork this repository to your GitHub account by clicking the **Fork** button at the top right of this page. |
| 9 | +- Clone the forked repository to your local machine: |
| 10 | + |
| 11 | +```bash |
| 12 | +git clone https://github.com/ayusshrathore/leetcode |
| 13 | +``` |
| 14 | + |
| 15 | +- Create a new branch for your changes: |
| 16 | + |
| 17 | +```bash |
| 18 | +git checkout -b my-new-branch |
| 19 | +``` |
| 20 | + |
| 21 | +- Make your changes to the project and commit them. Please follow the [commit message guidelines](#commit-message-guidelines). |
| 22 | + |
| 23 | +- Push your changes to GitHub: |
| 24 | + |
| 25 | +```bash |
| 26 | +git push origin my-new-branch |
| 27 | +``` |
| 28 | + |
| 29 | +- Open a pull request in this repository by clicking the **Pull Request** button at the top right of this page. |
| 30 | + |
| 31 | +- Wait for your pull request to be reviewed and merged. |
| 32 | + |
| 33 | +## Commit Message Guidelines |
| 34 | + |
| 35 | +### Type |
| 36 | + |
| 37 | +- **feat:** Use when adding new features or problems. |
| 38 | +- **fix:** Use when fixing bugs. |
| 39 | +- **refactor:** Use when refactoring code or making improvements. |
| 40 | +- **docs:** Use when updating documentation. |
| 41 | +- **test:** Use when adding or modifying tests. |
| 42 | +- **chore:** Use for routine tasks, maintenance, or non-code changes. |
| 43 | + |
| 44 | +### Brief Description |
| 45 | + |
| 46 | +Provide a concise description of the change, starting with a verb in the imperative mood (e.g., "Add solution for problem XYZ," "Fix issue with ABC"). |
| 47 | + |
| 48 | +### Optional Body |
| 49 | + |
| 50 | +Include a more detailed explanation if the brief description is not sufficient. Describe the problem, solution, and relevant context. You can use bullet points or paragraphs for clarity. |
| 51 | + |
| 52 | +### Optional Footer |
| 53 | + |
| 54 | +- Reference related issues or pull requests using `Closes #issue-number` or `Fixes #issue-number` to automatically close them when the commit is merged. |
| 55 | +- Include any breaking changes or important information for other contributors. |
| 56 | + |
| 57 | +#### Examples |
| 58 | + |
| 59 | +- Adding a new LeetCode problem: |
| 60 | + |
| 61 | + ``` |
| 62 | + feat: Add solution for problem 123 |
| 63 | + ``` |
| 64 | +
|
| 65 | +- Fixing a bug in an existing solution: |
| 66 | +
|
| 67 | + > Correct an edge case handling bug in the Python solution. |
| 68 | + > Fixes #456 |
| 69 | +
|
| 70 | + ``` |
| 71 | + fix: Fix issue with solution for problem 456 |
| 72 | + ``` |
| 73 | +
|
| 74 | +- Refactoring an existing solution: |
| 75 | +
|
| 76 | + > Simplify algorithm logic for problem 789. |
| 77 | +
|
| 78 | + > Enhance code comments for clarity. |
| 79 | +
|
| 80 | + ``` |
| 81 | + refactor: Improve code structure in solution for problem 789 |
| 82 | + ``` |
| 83 | +
|
| 84 | +- Updating documentation: |
| 85 | +
|
| 86 | + ``` |
| 87 | + docs: Update README with instructions for contributions |
| 88 | + ``` |
| 89 | +
|
| 90 | +> **Note**: For more information on commit message guidelines, see [conventionalcommits](https://www.conventionalcommits.org/en/v1.0.0/). |
| 91 | +
|
| 92 | +## Organizing and Solving Problems |
| 93 | +
|
| 94 | +<!-- create an nice looking path list --> |
| 95 | +
|
| 96 | +- Browse through the existing sections in the repository to find the topic or category where you'd like to contribute. |
| 97 | +
|
| 98 | +- If you're adding a new problem, make sure it's not already in the repository to avoid duplicates. If it's not already in the repository, create a new folder with a README.md file inside it. The README.md file should contain a brief description of the problem, a link to the problem on LeetCode, and a link to the solution. |
| 99 | +
|
| 100 | +- Create a new directory under the appropriate section for your problem (e.g., arrays, strings, trees, etc.). |
| 101 | +
|
| 102 | +- Add your problem's code in a language-specific subdirectory within the problem's directory (e.g., python, java, cpp, etc.). |
| 103 | +
|
| 104 | +- Include a clear and concise solution description in Markdown format. You can create a separate Markdown file within the problem's directory or add it as comments in your code. |
| 105 | +
|
| 106 | +- Ensure your code follows the coding conventions and style guide of the repository. |
0 commit comments