Check if the Sentence Is Pangram

Easy · Arrays & Hashing · Hash Table · String

Problem

A pangram is a sentence in which every letter of the English alphabet appears at least once.

You are given a string sentence made only of lowercase English letters. Return true if sentence is a pangram, and false otherwise.

Examples

Input: sentence = "sphinxofblackquartzjudgemyvow"
Output: true

All 26 letters appear at least once.

Input: sentence = "abcdefghijklmnopqrstuvwxy"
Output: false

Every letter but 'z' appears, and one missing letter is enough to fail.

Input: sentence = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Output: false

Thirty characters, but only one distinct letter. Length alone proves nothing.

Constraints

Approaches

Follow-up

What if the sentence were a stream too large to hold, and you wanted to stop reading as soon as the answer is known? Keep the mask and a count of distinct letters, and stop the moment the count reaches 26. For mixed-case text with spaces and punctuation, lowercase each character and skip anything that is not a letter.

Related problems

Start free on Cariara · Coding problems · System design studio

Starting Python
No results yet.

          
↑↓ move ↵ open esc close

Labs

Loading labs…

Run with your own input

Starting Python

Loading Python…