Apple logoApple
CodingMembers

Top K Closest Pairs in a Sorted Array

Members only

Given a sorted array, return the K pairs of values with the smallest absolute differences. The disclosed example uses [1, 2, 4, 7, 11, 16] and asks for the two closest pairs.

SWE
array
top-k
sorting
medium
Frequency
Single report
Last asked
2026-08-05
Stage
onsite-coding

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...