Search
⌘K

Leetcode 658. Find K Closest Elements

Given a sorted array, return the k integers closest to x (ties broken by smaller value) in ascending order. Use the sorted property to locate the optimal contiguous window of size k (e.g., via binary search on the window start or two-pointer shrinking).

Asked at:

Meta


Question Timeline

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

Mid July, 2025

Meta

Manager

Comments

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