Two sum: Difference between revisions

No change in size ,  7 years ago
no edit summary
No edit summary
Line 3:
;Task
Given a sorted array of single positive integers, is it possible to find a pair of integers from that array that sum up to a given sum? If so, return indices of the two integers or an empty array if not.
 
 
;Example
Line 8 ⟶ 9:
Because numbers[1] + numbers[3] = 2 + 19 = 21,<br/>
return [1, 3].
 
 
;Source
[http://stackoverflow.com/questions/8334981/find-pair-of-numbers-in-array-that-add-to-given-sum Stack Overflow: Find pair of numbers in array that add to given sum]
 
<br/><br/>
 
=={{header|C sharp|C#}}==
<lang csharp>public static int[] TwoSum(int[] numbers, int sum)
Anonymous user