Search
⌘K

Leetcode 2616. Minimize the Maximum Difference of Pairs

Given an array nums and integer p, choose p disjoint index pairs to minimize the maximum absolute difference among the pairs. Typical solution pattern: sort the array and use binary search on the allowed max-difference with a greedy scan to check if p pairs can be formed (n up to 1e5, p ≤ n/2).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.