in C Plus Plus by

How to find duplicates in a vector ?

1 Answer

0 votes
by
  • Create a map of <string , int> type to store the frequency count of each string in vector.
  • Iterate over all the elements in vector try to insert it in map as key with value as 1.
    • If string already exists in map then increment its value by 1.
...