Skip to content

Instantly share code, notes, and snippets.

@Yosuamuliawan19
Created March 21, 2022 16:42
Show Gist options
  • Save Yosuamuliawan19/6c9ed0101ae4a42d5dec8ca16765fd73 to your computer and use it in GitHub Desktop.
Save Yosuamuliawan19/6c9ed0101ae4a42d5dec8ca16765fd73 to your computer and use it in GitHub Desktop.
[Leetcode] Two Sum - Python
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
for i in range(len(nums)):
for j in range(i+1, len(nums)):
a = nums[i] + nums[j]
if (a == target):
return [i, j]
return [0,0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment