Skip to content

Commit 3be4572

Browse files
committed
@add: leetcode problem 1
1 parent 05503b6 commit 3be4572

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ _P.S. `master` branch is empty and has only this `README.md` file_
1515
- [Day 8](#day-8)
1616
- [Day 10](#day-10)
1717
- [Day 12](#day-12)
18+
- [Day 13](#day-13)
1819
- [Installation](#installation)
1920
- [Resources](#resources)
2021

@@ -78,6 +79,9 @@ From March 25th, 2020
7879
### Day 12
7980
- Lambda
8081

82+
### Day 13
83+
- Solving LeetCode program - [Problem](https://leetcode.com/problems/two-sum/)
84+
8185
## Installation
8286
Command used in Mac for installing supporting tools
8387
- Python3 - `brew install python3`

leetcode/Solution.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from typing import List
2+
class Solution:
3+
def twoSum(self, nums: List[int], target: int) -> List[int]:
4+
for j in range(0, len(nums)):
5+
for i in range(0, len(nums)):
6+
if (i!=j):
7+
sumOf=nums[j] + nums[i]
8+
if (sumOf == target):
9+
return j, i
10+
# Enumeration is faster than this

leetcode/twosum.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from Solution import Solution
2+
3+
sol = Solution()
4+
print(sol.twoSum([11, 7,22, 2], 9))

0 commit comments

Comments
 (0)