LinkedIn logoLinkedIn
CodingMembers

Find K Closest Elements in a Sorted Array (LC 658)

Members only

Given a sorted array, target `x`, and integer `k`, return the `k` closest values in sorted order, preferring the smaller value on equal distance. Implement the binary-search-on-window solution and dis...

SWE
array
binary-search
two-pointer
heap
top-k
io
medium
Frequency
Single report
Last asked
2026-08-16
Stage
onsite-coding

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...