InterviewDB Question

Minimum Difference Pair: Find the Pair of Elements with the Smallest Absolute Difference

Question Details

Problem Given an unsorted array of integers, find the pair (a, b) such that |a - b| is minimized. Return the difference. If multiple pairs tie, return any one. Example: Approach Sort the array, then scan adjacent pairs. O(n log n) time, O(1) extra sp…

Full Details

🔒

Unlock full leaked content

Full insider details, leaked discussions, and candidate experiences.

Get Premium →

Topics

Coding Phone