1.Given m arrays, and each array is sorted in ascending order.
2.Now you can pick up two integers from two different arrays (each array picks one) and
calculate the distance.
3.We define the distance between two integers a and b to be their absolute difference |a-b|.
4.Your task is to find the maximum distance.
5.You have to complete the function maxDistance() to return the maxDistance.
Input Format
3 3 1 2 3 2 4 5 3 1 2 3
Output Format
4
Constraints
1.Each given array will have at least 1 number. There will be at least two non-empty arrays. 2.The total number of the integers in all the m arrays will be in the range of [2, 10000]. 3.The integers in the m arrays will be in the range of [-10000, 10000].
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
3 3 1 2 3 2 4 5 3 1 2 3
Output
4