Reverse the Interior of Vowel-Bounded Words
Updated
Problem statement
You are given an array of strings text, where each string represents a word.
A word qualifies when both its first and last characters are vowels. The vowels are a, e, i, o, and u, and the check is case-insensitive.
For every qualifying word, reverse only the substring between its first and last characters. Keep the two endpoint characters unchanged. Leave every other word unchanged and preserve the original array order.
Return the modified array of strings.
Function
reverseVowelBoundedInteriors(text: String[]) → String[]Examples
Example 1
text = ["abcde","acvbn","Etuilo"]return = ["adcbe","acvbn","Eliuto"]abcdebegins withaand ends withe, so reversingbcdproducesadcbe.acvbndoes not end with a vowel and remains unchanged.Etuilobegins and ends with vowels; reversingtuilproducesEliuto.
Constraints
1 <= text.length <= 105- Every element of
textis a non-empty word containing uppercase or lowercase English letters. - The total number of characters across all words is at most
105. - Vowel checks are case-insensitive, while every character's original case is preserved.
More Visa Online Assessment questions
- Count Prime Values in SubtreesOA · Seen Nov 2026
- Lock CodeOA · Seen Nov 2026
- Minimum-Sum Tree Fill with Unit StepsOA · Seen Nov 2026
- Longest Non-Decreasing Substring After Pair SwapsOA · Seen Oct 2026
- Count Attack Vectors by Divisor RangeOA · Seen Oct 2026
- Minimum Operations to Reduce a Transaction LedgerOA · Seen Oct 2026
- Count Valid Space-Delimited WordsOA · Seen Oct 2026
- Earliest Common Meeting StartOA · Seen Oct 2026
- Maximum Index-Weighted Sum with Disjoint SwapsOA · Seen Oct 2026
- Maximum Equalized Substrings After One Adjacent SwapOA · Seen Sep 2026
Similar questions at other companies
- Reverse the Interior of Vowel-Bounded WordsZipRecruiter · OAZipRecruiter interview questions
- Check If Two String Arrays Are EquivalentMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
- Objects Seen on Both Days by Multiple ClientsGoogle · PHONE SCREENGoogle interview questions
- REST API: Country CodesHackerRank · OAHackerRank interview questions
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Find Words That Can Be Formed by CharactersTabaPay · OA
- Minimum Index Distance Between Person and CakeSnowflake · OA · PHONE SCREENSnowflake interview questions
- Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions