Editorial for UHCC1 P2 - String
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
This problem can be solved using brute-force. More specifically, construct an empty list filled with zeros of length , with position representing the appearance count of the character in . Iterate over all words and add ones to positions in the list representing its appearance wherever the word appears in . The answer is the number of characters that have a count greater than 1 in the list.
Worst Case Time Complexity: when there are many occurrences of the words in , where is the total characters of the words.
Comments