Data Structures & AlgorithmsVery hardTCS NQT · Infosys

How many substrings of "aeixoaeiuxoaeiou" consist only of vowels AND contain all five vowels a, e, i, o, u at least once?

  1. A. 5
  2. B. 2
  3. C. 3
  4. D. 12

Correct answer: C. 3

Two conditions: every letter is a vowel, and all five appear. Count substrings of vowel-only runs, checking coverage with a set. Counting substrings containing all five vowels, while ignoring the non-vowel letters, overcounts.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic