← Amazon questions

Find k closest elements to an element in an array

Filed under Amazon

Given a sorted array of integers, a target value, and an integer k, find the k closest elements to the target in the array. The result should be sorted in ascending order.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.