Please explain the output with respect to the input. Not at all clear.
Question Not Clear
n the problem statement
input is 5 1 3 5 2
after another 5 is given, 5 becomes the most frequent number then why is only 1 printed? shouldn’t all the numbers, i.e 3 too, be printed

here u have first output
5
then u get 1
so increasing freq o/p i s
1 5
then u get 3
arranging increasing freq 1 3 ( 5 is not printed this time just k ( 2) elements are printed)
then u have 5
so freq of 5 becomes 2
so greatest freq followed by increasing order
so u print 5 1
then u have 2
so the o/p is not affected
since 2 > 1
so 5 1 are printed again hence the output format
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.
