This file has been truncated. show original
Given three sorted arrays A, B and Cof not necessarily same sizes.
Calculate the minimum absolute difference between the maximum and minimum number from the triplet a, b, c such that a, b, c belongs arrays A, B, C respectively.
i.e. minimize | max(a,b,c) - min(a,b,c) |.
A : [ 1, 4, 5, 8, 10 ]
B : [ 6, 9, 15 ]
C : [ 2, 3, 6, 6 ]
Algorithm Behind this:
Initially point pointer to minimum element for all these array, Took absolute difference of maximum and minimum, then we can only way to minimise this difference by going forward to minimum element array.