DSA Advanced Problems

Find K Closest Elements

Given a sorted integer array, a count k, and a value x, return the k elements closest to x in nondecreasing order. Resolve equal distances in favor of the smaller value.