You are given an array of
Input Specification
The first line of the input contains two integers,
Output Specification
Print the lexicographically largest permutation you can make with at most
Constraints
Sample Input 1
5 1
4 2 3 5 1
Sample Output 1
5 2 3 4 1
Explanation of Output for Sample Input 1
You can swap any two numbers in
Sample Input 2
3 1
2 1 3
Sample Output 2
3 1 2
Explanation of Output for Sample Input 2
With 1 swap we can get
Sample Input 3
2 1
2 1
Sample Output 3
2 1
Explanation of Output for Sample Input 3
We can see that
Original Problem Author: MeHdi_KaZemI8; Problem Resource: HackerRank
Comments