Easy 0 solved 0% acceptance

Pangram Check

A pangram contains every English letter at least once.

What you'll learn

  • Collect the distinct letters of a text
  • Ignore case and non-letters
  • Compare against the 26-letter alphabet

Problem

A pangram contains every English letter at least once. Determine whether the text is a pangram. Ignore case, spaces, digits, and punctuation.

Implement pangram_check(text).

Input

text: The text to inspect.

Output

Return true if all 26 letters appear, otherwise false.

Constraints

0 ≤ text length ≤ 100,000. Input contains printable ASCII characters. Only letters A–Z and a–z count.

Examples

Example 1
Input:
text = "The quick brown fox jumps over the lazy dog."

Expected output:
expected = True
Input:
std::string text = "The quick brown fox jumps over the lazy dog.";

Expected output:
bool expected = true;
Input:
string text = "The quick brown fox jumps over the lazy dog.";

Expected output:
bool expected = true;

Explanation

Every letter from a through z appears at least once. Capital T counts as t.

Example 2
Input:
text = "abcdefghijklmnopqrstuvwxy"

Expected output:
expected = False
Input:
std::string text = "abcdefghijklmnopqrstuvwxy";

Expected output:
bool expected = false;
Input:
string text = "abcdefghijklmnopqrstuvwxy";

Expected output:
bool expected = false;

Explanation

This text contains a through y, but it has no z. One missing letter makes it false.

How to approach it

Try on your own first, then open one hint at a time.

Hint 1

Normalize the text so letter case does not matter.

Hint 2

Track which of the 26 letters have appeared at least once.

Hint 3

Ignore every non-letter character completely, including spaces and punctuation.

Expected complexity

O(n) time, O(1) extra space

References

This challenge is adapted for CodeUtility. Follow the statement and constraints above.

Learn from others

Community solutions

No published solutions yet. Solve this challenge to share the first one.