1. Given a sorted array, two integers k and x, find the k closest elements to x in the array. 2. The result should also be sorted in ascending order. 3. If two elements are equally close, the smaller elements are always preferred.
Input Format
First line contains N(size of the array) Second line contains N space separted integers. Third line contains two integera x and k.
Output Format
Return the array.
Constraints
0 < k < N 1<=N<=10^4 |A[i]|<=10^4
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
5 1 2 3 4 5 3 4
Output
2 5