Skip to content

Instantly share code, notes, and snippets.

@DataSolveProblems
Created September 17, 2019 15:42
Show Gist options
  • Save DataSolveProblems/a1a7c01e24da52445ad29378e6f69387 to your computer and use it in GitHub Desktop.
Save DataSolveProblems/a1a7c01e24da52445ad29378e6f69387 to your computer and use it in GitHub Desktop.
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
container = {}
for i, num in enumerate(nums):
if target - num in container:
return [container[target - num], i]
container[num] = i
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment