328. Check if the Sentence Is Pangram

Easy
Distinct Character Coverage
Hashing

Problem

A pangram is a sentence in which every lowercase English letter appears at least once. Given a string sentence containing lowercase English letters, return true if sentence is a pangram and false otherwise.

Examples

Example 1

Input: "thequickbrownfoxjumpsoverthelazydog"
Output: true

Example 2

Input: "leetcode"
Output: false

Example 3

Input: "abcdefghijklmnopqrstuvwxyz"
Output: true
Constraints

1 <= sentence.length <= 1000

sentence consists of lowercase English letters.

Hints

?? Track the distinct letters encountered.

?? The sentence is a pangram exactly when all 26 letters are present.

Expected Complexity
Time: O(n)
Space: O(1)
Follow-up

Can you solve it using a 26-bit integer mask?

Practice Notes

Attempts: 0

Time spent: 0min

Hints used: 0

00:00
Loading...
Case 1
Case 2
Case 3
Input
"thequickbrownfoxjumpsoverthelazydog"
Expected
true