Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Try to solve it in linear time/space.
Return 0 if the array contains less than 2 elements.
You may assume all elements in the array are non-negative integers and fit in the 32-bit signed integer range.
{优快云:CODE:635818}

本文探讨如何在线性时间和空间复杂度内找到未排序数组中连续元素的最大差距。特别地,文章假设所有数组元素均为非负整数,并且适合32位带符号整数范围。如果数组包含少于2个元素,则返回0。
2万+

被折叠的 条评论
为什么被折叠?



