Pattern : 2 DSA + MCQS
Given a string s, remove a vowel if it occurs individually, i.e. it does not have another vowel immediately adjacent to it.
If two or more vowels occur consecutively, leave all those vowels unchanged.
Return the resulting string.
A vowel is one of:
a, e, i, o, u
Input:
s = "abecid"
Here:
e is a single vowel → removei is a single vowel → removeOutput:
"abcd"
Input:
s = "beautiful"
If vowels occur consecutively, they should be preserved.
Input:
"ae b c ou"
The consecutive vowel groups ae and ou remain unchanged, while isolated vowels are removed.
Input:
s = "cat"
a is a single vowel, so:
Output:
"ct"
1 ≤ |s| ≤ 10^5
Expert in Data Structures & Algorithms. Building tools to help developers crack FAANG interviews.
Schlumbergera • Pending
Schlumbergera • Pending
Willingness • Pending
Willingness • Pending
Willingness • Pending