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.
A = [1, 2, 3, 4] B = 1
A = [3, 2, 1] B = 2
[4, 2, 3, 1]
[3, 2, 1]
In one swap we can swap (1, 4) so that the array becomes : [4, 2, 3, 1].
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 doubt? Checkout Sample Codes for more details.