
optimal soln
You are given an int array and a integer n.you have to display all the index pairs in array whc will have a sum of n. write a code for that??
this question was asked in 2nd round of microsoft interview in our campus today.i wrote a code with O(n square) complexity.but they expected O(n).wat will be the algo for O(n)???? i just need to know about the soln they hv kicked me out in this question

well I can think of several solutions far better than O(n^2) but not O(n) ...I would be very interested in seeing an O(n) solution.

post your soln watever u hv in mind or ur approach.just the algo

Do your own homework.
Quzah.

I can think of an O(n) solution provided you have a huge amount of memory, but see quzah's reply.

Closed due to lack of attempt on OP's part