Find two elements in an array whose sum is x

Given an array of integers and a number x. check if there exists two elements in the array whose sum = x. For every element arr[i] of the array, we need to check if the array contains (x-arr[i]) in it or not. This search for (x-arr[i]) can be made using linear search (O(n) -time algorithm), […]
 •  0 comments  •  flag
Share on Twitter
Published on July 21, 2018 13:24
No comments have been added yet.