please tell me what i am doing wrong
Https://ide.codingblocks.com/s/162155
@sarthaksingh
Your code more numbers than required. Also the output is not as per the problem. The elements must be sorted as per their frequency and elements with same frequency must be sorted in increasing order.
Input :
1
5 4
5 1 3 5 2
Expected Output :
5 1 5 1 3 5 5 1 3 5 1 2 3
Your Output:
5 1 5 1 3 5 1 3 5 5 1 3 5 5
At the fourth iteration , the frequency of 5 is 2 while frequency of 1 and 3 are 1. Hence the output at that iteration should 5 1 3. Whereas your code prints 1 3 5 5.
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.