diff --git a/README.md b/README.md deleted file mode 100644 index 4372b78..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# algorithms \ No newline at end of file diff --git a/arrays.md b/arrays.md new file mode 100644 index 0000000..1f784f3 --- /dev/null +++ b/arrays.md @@ -0,0 +1,24 @@ +# Arrays + ++ [Two Sum](#two-sum) + +## Two sum + +https://leetcode.com/problems/two-sum/ + +```python +class Solution(object): + def twoSum(self, nums, target): + """ + :type nums: List[int] + :type target: int + :rtype: List[int] + """ + + indices = {} + for index in range(len(nums)): + if target - nums[index] in indices: + return [indices[target - nums[index]], index] + indices[nums[index]] = index + +``` \ No newline at end of file