Tap here to switch tabs
Problem
Submissions

Problem: Maximum Gap

Maximum Gap asks you to find the largest difference between adjacent values after sorting an integer array. Return zero when the array has fewer than two elements.

Statement

Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains fewer than 22 elements, return 00.

Note: Successive elements are adjacent elements in the sorted order of nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Gap

Maximum Gap asks you to find the largest difference between adjacent values after sorting an integer array. Return zero when the array has fewer than two elements.

Statement

Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains fewer than 22 elements, return 00.

Note: Successive elements are adjacent elements in the sorted order of nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9