describe
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.
Example 1:
Input: sentence = "thequickbrownfoxjumpsoverthelazydog"
Output: true
Explanation: sentence contains at least one of every letter of the English alphabet.
Copy the code
Example 2:
Input: sentence = "leetcode"
Output: false
Copy the code
Note:
1 <= sentence.length <= 1000
sentence consists of lowercase English letters.
Copy the code
parsing
Find out if a string contains all lowercase English letters. The solution is simple: count the number of characters in the string to form a dictionary C, and determine whether the number of keys in C is greater than or equal to 26.
answer
class Solution(object):
def checkIfPangram(self, sentence):
"""
:type sentence: str
:rtype: bool
"""
if len(sentence)<26:
return False
return len(collections.Counter(sentence).keys())>=26
Copy the code
The results
Each node in the linked list Is linked to the given node in the linked list. Submissions in the Python online submissions for Check if the Sentence Is Pangram.Copy the code
Original link: leetcode.com/problems/ch…
Your support is my biggest motivation