If you are new to opensource and don't know how to contribute to a repository , give this a read .
You can contribute to this project through couple of ways .
These issues have been created with the help of a script , there are chances that an issue description can link to wrong question , feel free to mention in the issue , if you find a disparity .
Currently there are approximately 80 duplicates in the issue database , if you happen to find one , please comment to close one of them .
You can add solution to a problems , issues have been created for all free questions available in the list here.
- For adding a solution to a problem , comment on the related issue that you are willing to work on that problem .
- Once you are assigned the issues , in your fork , create a new branch named issueNumber.
- in that branch create a file named {questionNumber}.extension inside solutions folder.
> For eg : If i would like to create add a solution for Two sum problem in cpp , I will name it as
1.cpp - Copy your solution class from Leetcode into the file that you just created .
- If the code is in cpp , add the following two lines at the top of the code
#include <bits/stdc++.h>
using namespace std;
- Format your file with (Instruction below).
- Commit the changes and push them to Github.
- Create a pull request named in the format
Adding solution for {question number} - Update the pull request comment accordingly.
Note : If your pull request doesn't have a proper pull request comment , your pr will be closed.
This repository uses clang-format with Google style for formatting the files.
You can check out online articles/tutorials availble on the internet .
Example usage on Linux
-
Install
clang-formatsudo apt-get install clang-format -
In your terminal inside
solutionsfolder , run the below commandclang-format -i -style=Google *.cpp
This is just an example , you can use any way to format your code , the formatting should be based on clang-format and should use Google style . For eg. You can use this website
This repository uses google-java-format , for instructions on how to setup Check official docs
As of now , you dont need to format , the action will auto format the code , but later on you would be requried to contibute formatted code.