To solve the Leetcode Hard problem "Maximum Gap" in C++.
Admins please assign this to me under LGM SOC'21.
Details
Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0.
ExampleInput: nums = [3,6,9,1]
Output: 3
Explanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum difference 3.
Aim
To solve the Leetcode Hard problem "Maximum Gap" in C++. Admins please assign this to me under LGM SOC'21.
Details
Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains less than two elements, return 0.
Example Input: nums = [3,6,9,1] Output: 3 Explanation: The sorted form of the array is [1,3,6,9], either (3,6) or (6,9) has the maximum difference 3.
Programming language