Which test case in missing here for unlock question

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
vector arr;
//arr.reserve(n);
for(int i=0;i<n;i++)
{
int a;
cin>>a;
arr.push_back(a);
}
int i=0;
int a=n;
vector::iterator it=arr.begin();
while(k)
{
if(arr[i]==a &&(i<n))
{
a–;
i++;
it++;
}
else if(arr[i]!=a &&(i<n))
{
auto itt=find(arr.begin(),arr.end(),a);
swap(*it,itt);
k–;
it++;
a–;
i++;
}
}
for( auto it =arr.begin();it!=arr.end();it++)
{
cout<<
(it)<<" ";
}
cout<<endl;
return 0;
}

Hello @goyal431,

The find function of in your code is causing TLE.
Thus, i have used hashmap instead:

Hope, this would help.
The logic is same.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.