Find K-th Smallest Pair Distance
Try to solve the Find K-th Smallest Pair Distance problem.
We'll cover the following
Statement
Given an array of integers nums
and an integer k
, return the nums[i]
, nums[j]
), where i
j
num.length
.
The distance between a pair of integers,
and , is defined as the absolute difference between them.
Constraints:
nums.length
nums[i]
k
Note: Given an array of size
, the total number of possible pairs is given by . As evaluates to , there are exactly these much possible -distances.
Examples
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.