Check if the Sentence Is Pangram - Problem

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.

Input & Output

Example 1 — Complete Pangram
$ Input: sentence = "thequickbrownfoxjumpsoverthelazydog"
Output: true
💡 Note: This famous sentence contains every letter from a-z at least once, making it a pangram.
Example 2 — Missing Letters
$ Input: sentence = "leetcode"
Output: false
💡 Note: Missing many letters like 'a', 'b', 'f', 'g', etc. Only contains: l, e, t, c, o, d (6 unique letters).
Example 3 — Short Sentence
$ Input: sentence = "abc"
Output: false
💡 Note: Only contains 3 letters (a, b, c) out of the required 26 letters.

Constraints

  • 1 ≤ sentence.length ≤ 1000
  • sentence consists of lowercase English letters only

Visualization

Tap to expand
Pangram Detection: Need All 26 Letters"thequickbrownfoxjumpsoverthelazydog"↓ Check for all letters a-z ↓a✓ b✓ c✓ d✓ e✓ f✓ g✓ h✓ i✓ j✓ k✓ l✓ m✓n✓ o✓ p✓ q✓ r✓ s✓ t✓ u✓ v✓ w✓ x✓ y✓ z✓All 26 letters found!Output: true
Understanding the Visualization
1
Input
String containing only lowercase letters
2
Process
Check if all 26 letters a-z appear at least once
3
Output
Return true if pangram, false otherwise
Key Takeaway
🎯 Key Insight: Use a hash set to track unique letters and return early when all 26 are found
Asked in
Google 15 Amazon 12 Microsoft 8
54.5K Views
Medium Frequency
~8 min Avg. Time
2.2K Likes
Ln 1, Col 1
Smart Actions
💡 Explanation
AI Ready
💡 Suggestion Tab to accept Esc to dismiss
// Output will appear here after running code
Code Editor Closed
Click the red button to reopen