Search
⌘K

Leetcode 719. Find K-th Smallest Pair Distance

Given an array nums, return the k-th smallest absolute difference among all pairs nums[i], nums[j] (i < j). Typical efficient approach (needed for n up to 10^4) is to sort and binary-search the distance value while using a two-pointer/sliding-window to count how many pairs have difference ≤ mid.


Question Timeline

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

Comments

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