i was following the this question and i felt that this can be solved in O(NLogN). Below is my algorithm:
1. Sort list1 , list2, list3 i.e. O(NLogN)
2. while indexA < size and indexB < size and indexC < size //here size is the array size
int sum = a1[indexA] + a2[indexB] + a3[indexC]
if sum < total then choose the minimum value from a1, a2, a3 and increment that index
if sum > total print total can not be found and return
if sum == total then print the indexes
//this is O(N)
Hence all total O(NLogN). Please tell me about the correctness of the above algo.
EDIT
As Muckle_ewe has explained that this algo will fail in some places so there is no point in further discussing on the algo rather please comment whether the question can be solvable in O(NLogN) if so then algo, thanks?