A: Triple Texting
https://open.kattis.com/problems/tripletexting
Since Grandma repeats the word that she wants to send three times, each letter of the word is sent three times, and so if there is at most one mistaken letter, at least two of the three copies of the letter will be correct. Therefore we can construct the original word from the majority value of the letter at each position.
More formally, let be the original string, and let be the string Grandma sends (the input to the program). Then for , . An easy way to implement the majority function is
Last updated