Created
September 17, 2019 15:42
-
-
Save DataSolveProblems/a1a7c01e24da52445ad29378e6f69387 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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