I have an array of integer says [17, 1, 20, 4, 12, 9] I want to get all the couple whose sum is 21.
for example in given array output should be like:
17,4
1,20
12,9
I could achieve the same using two loops. But the complexity goes N^2. Is there any efficient way to do this.