Skip to content

Instantly share code, notes, and snippets.

@BharathKumarS
Last active February 17, 2020 19:23
Show Gist options
  • Save BharathKumarS/c257999a2d350a765f38f9078eebcb1f to your computer and use it in GitHub Desktop.
Save BharathKumarS/c257999a2d350a765f38f9078eebcb1f to your computer and use it in GitHub Desktop.
This was my first Leet Code attempt, Two Sum.
#Solution works only on LeetCode
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
anums = nums
for i in range(len(nums)-1):
for j in range(i+1,len(anums)):
if nums[i] + anums[j] == target:
return[i,j]
@BharathKumarS
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment