Skip to content

Instantly share code, notes, and snippets.

@y16ra
Created December 23, 2019 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save y16ra/3c48c607a4caf22d34a1d674f4cf5002 to your computer and use it in GitHub Desktop.
Save y16ra/3c48c607a4caf22d34a1d674f4cf5002 to your computer and use it in GitHub Desktop.
Awful python code for Two Sum problem
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
for i1, num1 in enumerate(nums):
for i2, num2 in enumerate(nums[i1+1:]):
if target == (num1 + num2):
return [i1, i2 + i1 + 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment