Search⌘ K
AI Features

Find K-th Smallest Pair Distance

Explore how to solve the problem of finding the kth smallest distance between pairs of integers by applying sorting and search strategies. Understand the problem constraints and develop an approach using binary search and two-pointer techniques to efficiently compute the distance.

Statement

Given an array of integers nums and an integer k, return the kthk^{th} smallest distance between any pair of integers (nums[i], nums[j]), where 00 \leq i << j << num.length.

The distance between a pair of integers, aa and ...