Please give a clear description of this question

Please give a clear description of this question.

Sample Input

1 <- no of testcases
5 2 <- no of elements and value of k
5 1 3 5 2 <- running stream data

first we got 5
so top 2 most freqent nos are 5 only as we have only one element so we print only one
ans= 5

then we got 1
so top 2 most frequent nos are 1 and 5 (in increasing order)
ans= 5 1 5

then we got 3
so top 2 most frequent nos are 1 3 (increasing order)
ans= 5 1 5 1 3

then we got 5
so top 2 most frequent nos are 5 and 1(smallest one )
ans=5 1 5 1 3 5 1

ans so on

i hope you got the point

nice explanation, mark this close. thank you.

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.