1. Sort the given array
  2. keep 2 pointers one at the start fo array and other at the end of end
  3. check if sum=array[i] + array[j] == x then display
  4. else if sum < X then i ++
  5. else j++
Advertisements