Check if sentence contains all English alphabets
Filed under Wells Fargo
Free read 1 of 3Confirm that uppercase and lowercase letters should be treated as equivalent.
The question
Given a sentence containing arbitrary characters (lowercase, uppercase, numbers, symbols), check if it contains every letter of the English alphabet (pangram check, case-insensitive).
Constraints
- 1 <= length of sentence <= 10^4
Examples
- Input
- sentence = "The quick brown fox jumps over the lazy dog"
- Output
- True
- Why
- Contains all 26 letters of the English alphabet.
Approach
Confirm that uppercase and lowercase letters should be treated as equivalent.
Iterate through 'a' to 'z' and check if each character exists in the processed sentence string.
Convert the string to lowercase, filter out non-alpha characters, put them in a set, and check if the set size equals 26.
Strings shorter than 26 characters, strings missing a single letter.
Solution
O(N) time, O(1) space (since alphabet set is fixed size 26)
import string
def check_pangram(sentence):
alphabet = set(string.ascii_lowercase)
found = set(c.lower() for c in sentence if c.isalpha())
return alphabet.issubset(found)
Tips
- What they are testing: Tests string normalization, set operations, and handling of non-alphabetic characters.
- Common mistake: Failing to convert the sentence to lowercase before checking uniqueness.
Related Wells Fargo questions
Collected from public candidate posts and coding forums. Updated Nov 2026.