PARQUE - Editorial
Problem Link:
PracticeAuthor, Tester and Editorialist:-
tejaram15
Difficulty:
EasyPre-Requisites:
NoneProblem Statement:
Given a string calculate the length of longest substring that contains only vowels.Explanation:
Maintain a variable which counts the length of the substring. Traverse through the string and increment the variable if the present character is a vowel else reset it to Zero.
Psuedo Code:
for(int i=0;i < n;)
{
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') cnt++,i++;
else cnt = 0,i++;
ans = max(ans,cnt);
}
Time Complexity: O(N)
Solution : Here