Simple Sorting question.Please Help

Hi everyone,

Link to the Question

My code using Maps

I have done this question previously using sorting and today i tried with using maps.

Everything seems correct in my code but still i got Wrong Answer :frowning:

Please see and point out the mistake in my code.

and i heard that the way maps keep the strings sorted is O(n^2) … is this true?
then in which situations maps are useful?

i think map will not allow storage of duplicate strings what if the same name occurs again in the input.

1 Like

print each string in the map for it->second number of times.

@somilgarg:

ya… u r correct… i have not thought of it

Thank you :slight_smile: