2616. Minimize the Maximum Difference of Pairs
You are given a 0-indexed integer array
nums
and an integerp
. Findp
pairs of indices ofnums
such that the maximum difference amongst all the pairs is minimized. Also, ensure no index appears more than once amongst thep
pairs.Note that for a pair of elements at the index
i
andj
, the difference of this pair is|nums[i] - nums[j]|
, where|x|
represents the absolute value ofx
.Return the minimum maximum difference among all
p
pairs.
1 | class Solution { |