MCPcopy Create free account
hub / github.com/DasyDong/developer-roadmap / two_sum

Function two_sum

code/run_comp.py:3–11  ·  view source on GitHub ↗

:type nums: List[int] :type target: int :rtype: List[int]

(nums, target)

Source from the content-addressed store, hash-verified

1# coding: utf-8
2
3def two_sum(nums, target):
4 """
5 :type nums: List[int]
6 :type target: int
7 :rtype: List[int]
8 """
9 for i in nums:
10 if target - i in nums and i is not target-i:
11 return [nums.index(i), nums.index(target - i)]
12
13
14def run_twosum():

Callers 1

run_twosumFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected