17 lines
387 B
Python
17 lines
387 B
Python
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])) |