Formatted question description:

1832. Check if the Sentence Is Pangram




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.

Example 1:

Input: sentence = “thequickbrownfoxjumpsoverthelazydog”

Output: true

Explanation: sentence contains at least one of every letter of the English alphabet.

Example 2:

Input: sentence = “leetcode”

Output: false


  • 1 <= sentence.length <= 1000
  • sentence consists of lowercase English letters.


Use a set to store all the lowercase letters that exist in sentence. Return true if and only if the set’s size is 26.

class Solution {
    public boolean checkIfPangram(String sentence) {
        Set<Character> set = new HashSet<Character>();
        int length = sentence.length();
        for (int i = 0; i < length; i++) {
            char c = sentence.charAt(i);
            if (c >= 'a' && c <= 'z')
        return set.size() == 26;

All Problems

All Solutions