in solution ,they have not used priority queue!
Doubt in solution given
@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!
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!