Given a sorted integer array `arr`, two integers `k` and `x`, return the `k` closest integers to `x` in the array. The result should also be sorted in ascending order.
An integer `a` is closer to `x` than an integer `b` if:
- `|a - x| < |b - x|`, or
- `|a - x| == |b - x|` and `a < b`
### Constraints
- `1 <= k <= arr.length <= 10^4`
- `arr` is sorted in ascending order.
- `-10^4 <= arr[i], x <= 10^4`
### Input Format
- Line 1: Space-separated integers representing `arr`.
- Line 2: Two space-separated integers `k` and `x`.
### Output Format
Print the `k` closest integers separated by a space.
Sample Cases
Example 1Sample Case
Input: 1 2 3 4 5
4 3
Output: 1 2 3 4
Example 2Sample Case
Input: 1 1 2 3 4 5
4 -1
Output: 1 1 2 3
Example 3Sample Case
Input: 1 2 3 4 5
3 4
Output: 3 4 5
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.