Unlock problem stl

code failing test case 4 any help
https://hack.codingblocks.com/contests/c/547/1556

Can you share your code ?


sorry for the delay

I think the question demands us to perform ATMOST K SWAPS, and not EXACTLY K SWAPS.

https://ide.codingblocks.com/s/46644
Here is my accepted solution.

Shekhar is a bomb defusal specialist. He once encountered a bomb that can be defused only by a secret code. He is given a number N and a number K. And he is also given permutation of first N natural numbers . The defusal code is the largest permutation possible by doing exactly K swaps among a pair of the given permutation. Help him to find the final permutation.

the largest per. of n natural no is n,n-1,n-2 … 1 so if u acheive the code then no swap if there is k>0
check this https://ide.codingblocks.com/s/46846

so the qstn should be atmost k swaps?not exact k swaps. plz ask the setter to change the qstn statement i spent 3-4 hrs debugging the wrong qstn

you have sent the link of different qstn

its not ques its sol of the question u posted.