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?
- A. 5
- B. 2
- C. 3
- 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.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- Consider the pattern-matching algorithms: naive, KMP, Rabin–Karp (polynomial rolling hash), Z-function. Which statement is correct?
- A polynomial rolling hash with a fixed modulus M and random base B is used to compare two different strings of length L. Which statement…
- What is the length of the longest palindromic substring of "bananaracecarbnn"?
- Apply the reversal of the first 4 elements to the queue 1, 2, 3, 4, 5, 6, 7, 8 (front first). What is the element at position 6 of the…
- For the array [1, 3, 2, 4], take the next strictly greater element of each position (-1 if none) and sum these values, ignoring the -1…
- What is the sum of the minimum of every contiguous window of length 2 in the array [3, 1, 4, 1, 5, 9, 2, 6]?