Problem Description
Given an integer array A of size N consisting of unique integers from 1 to N. You can swap any two integers atmost B times.
Return the largest lexicographical value array that can be created by executing atmost B swaps.
1 <= N <= 106
1 <= B <= 109
First argument is an integer array A of size N.
Second argument is an integer B.
Return an integer array denoting the largest lexicographical value array that can be created by executing atmost B swaps.
Input 1:
A = [1, 2, 3, 4] B = 1
Input 2:
A = [3, 2, 1] B = 2
Output 1:
[4, 2, 3, 1]
Output 2:
[3, 2, 1]
Explanation 1:
In one swap we can swap (1, 4) so that the array becomes : [4, 2, 3, 1].
Explanation 2:
Array is already the largest lexicographical value array.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.