#1832
Easy Algorithms Check if the sentence is pangram
Hash Table String
84.1% acceptance
Feb 25, 2026
3016
66
A pangram is a sentence where every letter of the English alphabet appears at least once.
Given a string sentence containing only lowercase English letters, return true if sentence is a pangram, or false otherwise.
Solution
Rust
Time O(n)
Space O(1)
impl Solution {
pub fn check_if_pangram(sentence: String) -> bool {
let mut mask = 0u32;
for b in sentence.bytes() {
mask |= 1 << (b - b'a');
}
mask == (1 << 26) - 1
}
}