'Minimize the difference between maximum and minimum of the chosen elements

Suppose given m sorted array with the total number of n elements. our goal is, to choose one element from each sorted array such that the difference between the maximum and the minimum of chosen elements is minimized.

I think we can solve the above problem in O(m log n) and I read this post, but I can't use that reference to solve the above problem.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source