- Tag: #array
Given a 2D array size of n * m and the elements of each row of the array are sorted. Select 1 number from each row and select n numbers in total. And the diff of n numbers is maximum-minimum, find the minimum diff.
Input: [[1,2,3,4,5],[6,7,8,9,10]] Output: 1
Credits To: lintcode.com
Leave me comments, if you have better ways to solve.
- Solution: XXX
Walk Through Testdata
// Blog link: https://code.dennyzhang.com/minimum-difference