Last active
August 29, 2023 09:34
-
-
Save codeperfectplus/f553a3fab48e3b9bd1e9e750d30979d2 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
| def twoSum(self, nums: List[int], target: int) -> List[int]: | |
| seen = {} | |
| for index, num in enumerate(nums): | |
| other = target - num | |
| if other in seen: | |
| return[seen[other],index] | |
| else: | |
| seen[num] = index | |
| return [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment