Created
March 21, 2022 16:42
-
-
Save Yosuamuliawan19/6c9ed0101ae4a42d5dec8ca16765fd73 to your computer and use it in GitHub Desktop.
[Leetcode] Two Sum - Python
This file contains 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]: | |
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