Skip to content

Commit

Permalink
Create two-sum.py
Browse files Browse the repository at this point in the history
Not particularly elegant, but does the job
  • Loading branch information
gabedonnan authored Jan 12, 2023
0 parents commit a8dcdf8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions two-sum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
temp = []
for i,num in enumerate(nums):
for j, item in enumerate(temp):
if item + num == target:
return [i,j]
temp.append(num)

0 comments on commit a8dcdf8

Please sign in to comment.