Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-145

Most Common Letter

Problem

Return the most frequent letter in the text. Break ties alphabetically by choosing the earliest letter; assume the text is non-empty and contains only uppercase A-Z.

Hint

E is the most common letter in English, but only if your sample is long enough.

Test cases

case 1
in: ["HELLO"]
expected: "L"
case 2
in: ["AABB"]
expected: "A"
case 3
in: ["ZYXZ"]
expected: "Z"
case 4
in: ["ABCD"]
expected: "A"
Starter codePython
def most_common_letter(text):
    # Your code here
    pass

4 test cases · run your code against them in the editor