Given an array arr[] of positive integers and an integer k, sort the array in ascending order such that the element at index kth stays unmoved and all other elements are sorted.
Examples:
Input: arr[] = [10, 4, 11, 7, 6, 20], k = 2
Output : [4, 6, 11, 7, 10, 20]
Explanation: Sorting array except an index 2 So, [4, 6, 11, 7, 10, 20].
Input: arr[] = [30, 20, 10], k = 0
Output: [30, 10, 20]
Explanation: the 0th index is unmoved so array become,[30, 10, 20].
Expected Time Complexity: O(nlogn).
Expected Auxiliary Space: O(1).
Constraints:
1 ≤ arr.size() ≤ 105
1 ≤ arr[i] ≤ 105