LeetCode [1] Two Sum_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > LeetCode [1] Two Sum

LeetCode [1] Two Sum

 2015/2/10 1:04:12  spirals  程序员俱乐部  我要评论(0)
  • 摘要:题目:Givenanarrayofintegers,findtwonumberssuchthattheyadduptoaspecifictargetnumber.ThefunctiontwoSumshouldreturnindicesofthetwonumberssuchthattheyadduptothetarget,whereindex1mustbelessthanindex2.Pleasenotethatyourreturnedanswers(bothindex1andindex2
  • 标签:

题目:

?

Given an array of integers, find two numbers such that they add up to a specific target number.

The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based.

You may assume that each input would have exactly one solution.

Input:?numbers={2, 7, 11, 15}, target=9
Output:?index1=1, index2=2

?

  • 相关文章
发表评论
用户名: 匿名