Also is the time complexity of code more than what is asked in question? How?
Can you tell why my code is failing test cases?
I tried to submit the code but its giving TLE. Please help me out? How is my code exceeding the time limit?
this part
if(freq[a[i]]!=0)
{
cout<<a[i]<<endl;
freq[a[i]]--;
continue;
}
This part is incorrect. You need to iterate over i from 0 to 2 and not on a[i].