Maximum Gap

Hard

📝 Description

Find maximum difference between successive elements in sorted form (O(n) time/space)

Input Format

Space-separated array elements

Output Format

Maximum gap

Constraints

1 ≤ nums.length ≤ 10^5

🔍 Sample Input

3 6 9 1
            

✅ Sample Output

3
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run