U have got 3 sorted arrays A1 A2 and A3 having m n and p elements
respectively. A gap of 3 arrays is defined to be max distance between
3 nos if they are put on a no line say u pick three 2 12 and 7 then
the gap is 10. Now u have to find an efficient way of chosing 3 nos
from these 3 seperate
merge two and if required third array keeping array tag with the elements
walk over the merged list and see adjacent distance which is minimum with
the condition that the tage of the adjacent elements are different
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
I think this will work,
have 3 pointers p,q,r pointing last elements of the 3 lists.
compute the difference between each pair.
decrement the index of the list having the min element.
(at each stage, save the current indices and current max distance).
Same logic for the min distance part, just