Skip to content

Commit 747c821

Browse files
author
yangdi
committed
add mine codes for leetcode.
1 parent 6c50278 commit 747c821

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src2/2Sum/2sum.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'''
2+
Given an array of integers, find two numbers such that they add up to a specific target number.
3+
4+
The function twoSum should return indices of the two numbers such that they add up to the target,
5+
6+
where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based.
7+
8+
You may assume that each input would have exactly one solution.
9+
10+
Input: numbers={2, 7, 11, 15}, target=9
11+
Output: index1=1, index2=2
12+
'''
13+
14+
15+
class Solution:
16+
# @return a tuple, (index1, index2)
17+
def twoSum(self, num, target):
18+

0 commit comments

Comments
 (0)