FastPrepSubstrings Made Only of Vowels
Problems/Substrings Made Only of Vowels

Substrings Made Only of Vowels

Expedia logoExpedia● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An entry from an Expedia Group SDE intern process names this task in its video-call interview, on November 21, 2020.

The entry gives only the title. A separate card for that title gives the task for a lowercase string of up to 5,000 letters, names a, e, i, o and u as the vowels, and its sample counts a substring once for each place it appears. Here, the function takes one string instead of several test cases.

Our version is about 95% the same as the reported question.

You are given a string s of lowercase English letters. The vowels are a, e, i, o and u; every other letter, including y, is a consonant.

A substring is a run of one or more consecutive letters of s. Return the number of substrings that are made only of vowels.

Substrings are counted by their position: two equal substrings that start at different places in s count as two.

Function

countVowelOnlySubstrings(s: String) → int

Examples

Example 1

s = "beautiful"return = 8

The vowel letters form the blocks "eau", "i" and "u". The block "eau" gives 6 substrings: "e", "a", "u", "ea", "au" and "eau". The blocks "i" and "u" give 1 each. The total is 6 + 1 + 1 = 8.

Example 2

s = "rhythm"return = 0

The string has no vowels (the letter y is not a vowel here), so no substring is made only of vowels.

Example 3

s = "queueing"return = 15

The only vowel block is "ueuei", 5 letters long. It has 5 substrings of length 1, 4 of length 2, 3 of length 3, 2 of length 4 and 1 of length 5, so the answer is 5 + 4 + 3 + 2 + 1 = 15. Equal substrings at different places, such as the two "ue", are counted separately.

Constraints

  • 1 <= s.length <= 5000
  • s contains only lowercase English letters.

More Expedia Onsite Interview questions

  • Scramble StringONSITE INTERVIEW · Seen Sep 2026
  • Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
  • Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
  • Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
  • Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
  • Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
  • Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
  • Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
  • Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Roman to IntegerKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Convert Hexadecimal to Dotted IPv4Microsoft · ONSITE INTERVIEWMicrosoft interview questions
  • Palindrome Match PercentageApple · ONSITE INTERVIEWApple interview questions
  • Caesar Cipher with a Precomputed AlphabetAmazon · ONSITE INTERVIEW
  • Add Two Binary StringsPeopleStrong · ONSITE INTERVIEWPeopleStrong interview questions
  • Most Cost-Effective MachineCapital One · ONSITE INTERVIEWCapital One interview questions
  • Add Two Numeric Strings with CarryZipRecruiter · ONSITE INTERVIEWZipRecruiter interview questions
  • Calculate a Token-List ExpressionCollege Vine · ONSITE INTERVIEW
  • Iterate Canonical IPv6 AddressesOpenAI · ONSITE INTERVIEWOpenAI interview questions
  • Nth Staged License PlateGoogle · ONSITE INTERVIEWGoogle interview questions

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)
  • Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
class Solution {
    public int countVowelOnlySubstrings(String s) {
        // Write your code here.
    }
}
Checking account…