Really can’t understand numbers given at explanation part.

A : [ 1, 4, 5, 8, 10 ]

B : [ 6, 9, 15 ]

C : [ 2, 3, 6, 6 ]

==> a=5, b=6, c=6

5 = is middle element of A

6 = min from B

6 = max from C

Really strange

Really can’t understand numbers given at explanation part.

A : [ 1, 4, 5, 8, 10 ]

B : [ 6, 9, 15 ]

C : [ 2, 3, 6, 6 ]

==> a=5, b=6, c=6

5 = is middle element of A

6 = min from B

6 = max from C

Really strange

Forget about the indexes in the array.

Just think that, if you are given three numbers a, b, c. How will you minimize the difference between the maximum of (a,b,c) and the minimum of (a,b,c)?

If you just work it out with an example, you will find that it’s just about finding a combination of a,b,c such that the maximum of (a,b,c) is decreasing OR the minimum of (a,b,c) is increasing.Which gives the desired result(the minimum difference).

Now to use this concept in this problem, you just have to move the three indexes in such a way that the minimum element from these three numbers, is always increasing, which provides the best possibility of finding the difference.

Hope this clarifies.

Question can be rephrased as:

**Find i, j, k such that difference between the maximum of (A[i],B[j],C[k]) and the minimum of (A[i],B[j],C[k]) is minimized.**