Find most frequent word in stream of k words

Revision en1, by jrrain, 2016-12-08 09:36:47

I was solving this. My approach uses a queue to store k elements.A map and set are are also used in order to get most frequent lexicographically smallest string. But if I am using set to find lexicographically smallest frequent string it is getting tle. Please suggest some optimisations!.Here's my code

Tags c++, strings, stl, sets

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English jrrain 2016-12-08 09:36:47 419 Initial revision (published)