Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import permutations as perm
- def TwoSum(arr, target):
- L1 = perm(arr, 2)
- for i in L1:
- if sum(i) == target:
- return [arr.index(i[0]), arr.index(i[1])]
- var = TwoSum([3,2,4], 6)
- print(var)
Advertisement
Add Comment
Please, Sign In to add comment