Editorial for TLE '16 Contest 3 P1 - Hapax Legomenon
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
This problem is a simple implementation problem; simply count the number of strings that only appear once in the given list.
We can use a map to accomplish this by incrementing mp[string] for each string. After, we can iterate through the map keys and check which strings have a value of 1.
There is a less efficient way to accomplish the task, but it does not require a map and it will pass all of the cases. We simply keep track of all previous strings and keep track if a string has been duplicated or not. When we input a string, compare it to all previous strings. If we find that a string already exists, flag both strings that they have been duplicated. Afterward, count the number of strings that have not been flagged.
Time Complexity: or
Comments