We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Java
public static boolean checkPangram(String str) {
// Normalize the string to lowercase and remove non-letter characters
String normalizedStr = str.toLowerCase().replaceAll("[^a-z]", "");
// Use a set to track unique letters
HashSet<Character> lettersSet = new HashSet<>();
// Add each character to the set
for (char c : normalizedStr.toCharArray()) {
lettersSet.add(c);
}
// Check if the size of the set is 26 (number of letters in the alphabet)
return lettersSet.size() == 26;
hint: in typescript you can use
let char = char.toLowerCase(); /a-z/,test(char) -> to test all alphabet (a-z and A-Z)
My solution in C++
}
Python Solution
def pangrams(s): # Write your code here s = s.lower() letter_set = set(s) alphabet_set = set("abcdefghijklmnopqrstuvwxyz")