01. Panagram Checking
The problem can be found at the following link: Question Link
My Approach
Vector Initialization: Create a vector
f
of size 26, initialized with zeros. This vector is used to keep track of the occurrence of each letter in the alphabet.Iterate Through the String: Iterate through each character in the input string.
Convert to Lowercase: Convert the current character to lowercase.
Check if Character is a Lowercase Letter: If the character is a lowercase letter, update the corresponding index in the vector
f
to 1.Check Pangram Condition: Check if all elements in the vector
f
are set to 1. This indicates that all lowercase letters are present in the input string.
Time and Auxiliary Space Complexity
Time Complexity: The time complexity is O(n), where n is the length of the input string. This is because each character is processed once.
Auxiliary Space Complexity: The auxiliary space complexity is O(1) since the size of the vector
f
is constant (26).
Code (C++)
Contribution and Support
For discussions, questions, or doubts related to this solution, please visit our discussion section. We welcome your input and aim to foster a collaborative learning environment.
If you find this solution helpful, consider supporting us by giving a ⭐ star
to the getlost01/gfg-potd repository.
Last updated