:type nums: List[int] :type target: int :rtype: List[int]
(nums, target)
| 1 | # coding: utf-8 |
| 2 | |
| 3 | def 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 | |
| 14 | def run_twosum(): |