https://ide.codingblocks.com/s/440317 ,
i’d done this question like this, pls coorect me where i’m wrong
K frequent in running stream of numbers
@CODER_JATIN you will have to use a custom comparator for priority queue as per the output required by the problem, i have updated your code a little look at the comments for more information https://ide.codingblocks.com/s/440385
bhaiya ye jo aapne functor bnaya hai iski working smjhado
if frequency (X.first) is different arrange them in decreasing order means number with larger frequency will be at the top of the queue else arrange them in increasing order of their number (X.second) means smaller value will be at the top if frequency 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.