< Back





1832. Check if the Sentence Is Pangram

Not really a serious question, to be honest. A pangram is a sentence where every letter of the
English alphabet appears at least once. We know the English alphabet has 26 letters, so we just
declare the input string as a set and check to see if the length of the set is 26.

The solution is as follows:


  class Solution:
      def checkIfPangram(self, sentence: str) -> bool:
          return len(set(sentence)) == 26


_ Time Complexity:

  O(1) - We know the English alphabet has 26 letters, so we know the set will have at most 26.

_ Space Complexity:

  O(1) - The input string only consists of alphabet letters, so the set will have at most 26.