* **First steps:** * Clone this repository and create a new branch with convenient names like the followings: * add-problem-name * add-problem-name-approach-2 * fix-problem-name-python-sol * fix-problem-name-readme * When you are done with your code open a new PR to the master and describe in your PR why you creating this PR: * Adding Problem Name (as a link to the problem) solution in [Chosen language]. ****************** * **Add a new solution for an existing problem:** * You need to update the existing problem `README.md` file with your solution. * The file will be organized in this hierarchy: * Approach 1 * Approach 2 * ...etc * So check what is the level of your solution and add it: * Approach 2:
`your solution` * If you add a new solution without explaining it do your best at least to add the time & space complexity for it or pseudocode. * If you can not fit the previous step you can ignore the hierarchy of the `Approaches` and add your solution this way: * Another implementation in `the language you writing in`. (Make sure it is a URL to the solution.[js,java] file) * Let's say if your new solution is in a language already exist in the repo like `Solution.py` you can edit this file by adding another function lets say the solution in function called `sum2numbers(x,y)` add new function `sum2numbers_2(X,Y)`, I would prefer doing it this way otherwise you can create a new file called `Solution2.py`. * If your solution the same idea as `Approach 1` for example but in different language you just need to add as mentioned above and update the problem `README` file with a link to your code: * **Solution in java** as url of course to **Solution.java**. ************** * **Add a new solution for a new problem:** * So, let's say the problem belongs to the `30-Day LeetCoding Challenge` so go to it is a directory and create a new folder with the problem name `new-problem` add a URL to that directory in the `README.md` if it is `week` not there add it as well in the same way as the existing ones. * Then, under the `new-problem` directory create `README.md` file and `Solution.[chosen-lang]`. * Write the `README.md` file in the same way as existing one's header with the problem name as URL to the problem location on Leetcode, then add `Approach 1` title then add your solution follow the steps as in the above section (Add a new solution for an existing problem). * What if it is a random problem from [Leetcode problem](https://leetcode.com/problemset/all/), create a new directory for this new problem in the main folder `leetcode-problems/the-new-random-problem` and add it in the main [`README.md`](https://github.com/AhmedRaafat14/Leetcode-problems/blob/master/README.md) as well as URL to this new directory for sure, the structure of the `the-new-random-problem` must be the same as above. **Feel free to open issues with any required changes**