Check if the Sentence Is Pangram - Problem
A pangram is a fascinating type of sentence that contains every letter of the English alphabet at least once. The most famous example is "The quick brown fox jumps over the lazy dog."
Your task is to determine whether a given string is a pangram. You'll receive a sentence containing only lowercase English letters, and you need to return true if the sentence is a pangram, or false otherwise.
Think of it as checking if you have a complete collection - you need all 26 letters from 'a' to 'z' to appear at least once in your sentence!
Examples:
"thequickbrownfoxjumpsoverthelazydog"โ true (contains all 26 letters)"leetcode"โ false (missing many letters)
Input & Output
example_1.py โ Complete Pangram
$
Input:
sentence = "thequickbrownfoxjumpsoverthelazydog"
โบ
Output:
true
๐ก Note:
This sentence contains every letter from 'a' to 'z' at least once, making it a perfect pangram.
example_2.py โ Incomplete Sentence
$
Input:
sentence = "leetcode"
โบ
Output:
false
๐ก Note:
This sentence only contains letters: e, l, t, c, o, d. It's missing 20 letters of the alphabet (a, b, f, g, h, i, j, k, m, n, p, q, r, s, u, v, w, x, y, z).
example_3.py โ Edge Case Single Letters
$
Input:
sentence = "abcdefghijklmnopqrstuvwxyz"
โบ
Output:
true
๐ก Note:
This string contains exactly one occurrence of each letter in alphabetical order, making it a minimal pangram.
Constraints
- 1 โค sentence.length โค 1000
- sentence consists of lowercase English letters only
- No spaces, punctuation, or uppercase letters to worry about
Visualization
Tap to expand
Understanding the Visualization
1
Start Collection
Begin with empty collection, scan each character
2
Collect Letters
Add each new letter type to our collection
3
Check Completeness
Success when we have all 26 letter types
Key Takeaway
๐ฏ Key Insight: A pangram detection is essentially a set collection problem - we need to efficiently track which unique letters we've seen and check if we have all 26. The hash set approach with early termination gives us optimal performance!
๐ก
Explanation
AI Ready
๐ก Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code