Interview Question
InternsCountry: United States
Interview Type: Phone Interview
Sorry....my bad..mapping here means ... pair should get add to the given value....
btw I gave 2 impl :
1. Sorting the array like the classic 2Sum problem.
2. Storing the arraying a arraylist and then checking for each element if (arrayList.comtains(givenSum - A[i]) && arraylist.getIndex(givenSum - A[i]) != i)...then its a pair we want....
It was asked in Amazon
You mean like a multi-map . I am not understanding the question here.
- David Billa February 01, 2013