less than 1 minute read

Given a list of integers nums, return the largest difference of two consecutive integers in the sorted version of nums.

Constraints

  • n ≤ 100,000 where n is the length of nums

https://binarysearch.com/problems/Largest-Gap

Examples

Example 1

Input

  • nums = [4, 1, 2, 8, 9, 10]

Output

  • answer = 4

Explanation

The largest gap is between 4 and 8.

Solution

Categories:

Updated:

Leave a comment