🎁 Exclusive Offer! Join our Telegram Channel to get **special discounts** and updates! 🚀

🚀 Struggling with coding interviews? We've got you covered! 💡 Practice real questions, sharpen your skills, and land your dream job! 🎯
Question 80 - 100% Working Solution | Buy Now

Description

5 Live
Vowel SubString Given a string composed of lowercase letters within the ASCII range 'a'-'z', determine the number of substrings that consist solely of vowels, where each vowel appears at least once. The vowels are ['a', 'e', 'i', 'o', 'u']. A substring is defined as a contiguous sequence of characters within the string. Example s = 'aeioaexaaeuiou' There is a substring to the left that is made of vowels, 'aeioae', which is followed by an 'x'. Since 'x' is not a vowel, it cannot be included in the substring, and this substring does not contain all of the vowels. It is not a qualifying substring. Moving to the right, there are four substrings that do qualify: 'aaeuiou', 'aaeuid', 'aeuiou', and 'aeuio'. Function Description Complete the function vowelSubstring in the editor with the following parameter(s): string s: a string Returns int: the number of substrings that consist of vowels only ('a', 'e', 'i', 'o', 'u') where every vowel appears at least once. Constraints 1 ≤ size_of(s) ≤ 10^5 s[i] is in the range ascii['a'-'z'] (where 0 ≤ i < size_of(s))

Asked in: MEESHO

Image of the Question

Question Image Question Image

All Testcases Passed ✔



Passcode Image

Solution


Please login to view the solution