求解释丽寇儿的新题maximum gap题目到底啥意思?# JobHunting - 待字闺中
y*e
1 楼
Given an unsorted array, find the maximum difference between the successive
elements in its sorted form.
Try to solve it in linear time/space.
我理解的是是找相邻两个数的差,把这些差(gap)从小到大排列,
但最后只return最大的差就行了?那还排列大小干嘛?
能有人给个例子介绍一下吗?
谢谢!
elements in its sorted form.
Try to solve it in linear time/space.
我理解的是是找相邻两个数的差,把这些差(gap)从小到大排列,
但最后只return最大的差就行了?那还排列大小干嘛?
能有人给个例子介绍一下吗?
谢谢!