Skip to content

Practice Count of Substrings Containing Every Vowel and K Consonants II

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3306
LeetCode Problem

Count of Substrings Containing Every Vowel and K Consonants II

Problem Statement

You are given a string word and a non-negative integer k. Return the total number of substrings of word that contain every vowel ('a', 'e', 'i', 'o', and 'u') at least once and exactly k consonants.

Source: Count of Substrings Containing Every Vowel and K Consonants II on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
word = "aeioqq", k = 1
Output
0

# Example 2

Input
word = "aeiou", k = 0
Output
1

# Example 3

Input
word = "ieaouqqieaouqq", k = 1
Output
3

Constraints

5 <= word.length <= 2 * 10^5
word consists only of lowercase English letters.
0 <= k <= word.length - 5

Related LeetCode Problems

Practice more problems similar to Count of Substrings Containing Every Vowel and K Consonants II.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.