Bank of America OA 2025 | Maximum Gap | Bucket Sort | Java Solution
Question · Posted Jun 2026
Problem Statement Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the array contains fewer than two elements, return 0. You must design an algorithm that runs in linear time O(n) and uses linear extra space O(n). Example 1 Input nums = [3,6,9,1] Output 3 Explanation Sorted array: [1,3,6,9] Successive differences: 3 - 1 = 2 6 - 3 = 3 9 - 6 = 3 Maximum Gap: 3 Example 2 ...
The full answer & interview discussion are available to premium members.
Log in Create a free account