Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
More concise solution

Adam Rizk

Jul 30, 2023

I think I have an even better solution since we don't need to explicitly check if each character is an alphabet or not, numerics and special characters are automatically excluded:

def checkIfPangram(self, sentence: str) -> bool:         charSet = set("abcdefghijklmnopqrstuvwxyz")         sentence = sentence.lower()         for char in sentence:             charSet.discard(char)         if len(charSet) == 0:             return True         return False

1

0

Comments
Comments
A
Adam Rizk2 years ago

Post has typos, meant the following:

def checkIfPangram(self, sentence: str) -> bool:         charSet = set("abcdefghijklmnopqrstuvwxyz")         sentence = sentence.lower()         for char in sentence:             charSet.discard(char)             if len(...

On this page

Problem Statement

Solution

Code

Time Complexity

Space Complexity

Conclusion