Doubt in solution given

in solution ,they have not used priority queue!

@varu this is because you need to update frequencies of elements who are not at top!
hence this cannot be done using priority_queue
so map/set are goto options!