leetcode-solutions

Leetcode Solutions

Live Website

</a>

Installation

Fork this repo then do following things

$ git clone "https://github.com/YOUR_USER_NAME/leetcode-solutions.git"
$ cd "leetcode-solutions"
$ cd "files/problems"

Inside the problems directory make your language directory (e.g. c, py, cpp) then create a file and paste your code, make sure your solution name match our Code of Contribution

Code Contribution

Example of valid solution naming:

1. two-sum.py
2. move-zeros.py
3. search-in-sorted-array.py
4. two-sum-II.py

Example of valid function with valid naming:

FILE: two-sum.py

@USER_NAME
Time: O(n)
Space: O(n); where n is the number elements present in the array

def two_sum(numArr, target):
    seen = {}
    for idx, val in enumerate(numArr): # loop with index, value
        compliment = target - val
        if compliment in seen:
            return [seen[compliment], idx] 
        seen[val] = idx

    return [-1, -1]


Be a contributor

Even if you have edited this README.md file or have just added one line of code, you are a contributor and you have helped the community, leave your name inside the contributors.md with your socials.

Happy Coding!