Skip to content

Instantly share code, notes, and snippets.

@enomoto
Created August 28, 2018 20:55
Show Gist options
  • Select an option

  • Save enomoto/21b2a88afcc83298e808fea628d6b779 to your computer and use it in GitHub Desktop.

Select an option

Save enomoto/21b2a88afcc83298e808fea628d6b779 to your computer and use it in GitHub Desktop.
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for i, num in enumerate(nums):
for j, num2 in enumerate(nums):
if i == j:
continue
if num + num2 == target:
return [i, j]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment