Solve smallest range of N-arrays

http://www.careercup.com/question?id=16759664