first attempt, solves 12/78
This commit is contained in:
parent
a3de7c9d08
commit
d257ab3564
@ -0,0 +1,17 @@
|
||||
def threeSum(nums):
|
||||
"""
|
||||
:type nums: List[int]
|
||||
:rtype: List[List[int]]
|
||||
"""
|
||||
# Always end at net zero from the sum
|
||||
first = 0
|
||||
second = 1
|
||||
solutionSets = []
|
||||
|
||||
for i in range(len(nums)):
|
||||
if nums[first] + nums[second] + nums[i] == 0:
|
||||
solutionSets.append([nums[first], nums[second], nums[i]])
|
||||
|
||||
|
||||
|
||||
print(threeSum([-1,0,1,2,-1,-4]))
|
||||
Loading…
Reference in New Issue
Block a user