In this article, we are going to see the interesting solution to the problem - "Maximum Gap". This will involve the concept of Bucket Sort and Radix Sort.
Pre-requisites:
Bucket SortRadix SortProblem Statement
Find the maximum difference between two successive elements in a given integer array nums after sorting it in non-decreasing order. If the length of nums is less than two, the function should return 0.
Example 1:
Input: nums = [10, 5, 20]
Output: 10
Explanation: After sorting the array...
Published on February 18, 2023 10:43