Check if the Sentence Is Pangram

easy bitmask string

Problem

Return whether sentence (lowercase) contains every letter of the English alphabet.

Inputsentence = "thequickbrownfoxjumpsoverthelazydog"
Outputtrue
All 26 letters present.

def check_if_pangram(sentence):
    mask = 0
    for c in sentence:
        mask |= 1 << (ord(c) - 97)
    return mask == (1 << 26) - 1
function checkIfPangram(sentence) {
  let m = 0;
  for (const c of sentence) m |= 1 << (c.charCodeAt(0) - 97);
  return m === (1 << 26) - 1;
}
class Solution {
    public boolean checkIfPangram(String sentence) {
        int m = 0;
        for (char c : sentence.toCharArray()) m |= 1 << (c - 'a');
        return m == (1 << 26) - 1;
    }
}
bool checkIfPangram(string sentence) {
    int m = 0;
    for (char c : sentence) m |= 1 << (c - 'a');
    return m == (1 << 26) - 1;
}
Time: O(n) Space: O(1)