Minimize the absolute difference
Given three sorted arrays A
, B
and C
of 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) |.
Example :
Input:
Output:
Explanation: We get the minimum difference for a=5, b=6, c=6 as | max(a,b,c) - min(a,b,c) | = |6-5| = 1
.
Last updated