MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / twoSum

Method twoSum

Array/two_sum.py:45–55  ·  view source on GitHub ↗
(self, nums, target)

Source from the content-addressed store, hash-verified

43
44class Solution(object):
45 def twoSum(self, nums, target):
46
47 result = self._twoSum(nums, target)
48 a = nums.index(result[0])
49 # b = nums.index(result[-1], a+1)
50 for i in range(len(nums)-1, -1, -1):
51 if nums[i] == result[1]:
52 return [a, i]
53 # b = i
54 # break
55 # return [a, b]
56
57
58 def _twoSum(self, nums, target):

Callers

nothing calls this directly

Calls 1

_twoSumMethod · 0.95

Tested by

no test coverage detected