![]() |
VOOZH | about |
Given a string s, check if it is Pangram or not.
A pangram is a sentence containing all letters of the English Alphabet.
Examples:
Input: s = "The quick brown fox jumps over the lazy dog"
Output: true
Explanation: The input string contains all characters from 'a' to 'z'.Input: s = "The quick brown fox jumps over the dog"
Output: false
Explanation: The input string does not contain all characters from 'a' to 'z', as 'l', 'z', 'y' are missing
Table of Content
The idea is to iterate over all characters from 'a' to 'z' and for each character, check if it is present in the input string or not. If any character is not present in the input string, return false. Otherwise, return true. Also, we need to ignore the case while searching for a character('a' and 'A' are considered same).
true
The idea is to create a visited array of size 26 to mark whether a character is present in the string or not. Now, iterate through all the characters of the string and mark them as visited. Lowercase and Uppercase are considered the same. So 'A' and 'a' are marked at index 0 and similarly 'Z' and 'z' are marked at index 25.
After iterating through all the characters, check whether all the characters are marked in visited array or not. If not then return false else return true.
false