Given a sorted array, find the k closest integers to x. The result should also be sorted in ascending order.
Find 4 closest elements to 3. Binary search for window start in [0, 1]
1
2
3
4
5
Binary search for the left boundary of the k-element window. Compare distance from x to arr[mid] vs arr[mid+k] to decide which direction to search.