Practice Count Beautiful Substrings II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Count nonempty contiguous substrings of s having equally many vowels and consonants and whose vowel-count times consonant-count is divisible by k. The vowels are a, e, i, o and u; all other lowercase letters are consonants.
Source: Count Beautiful Substrings II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "baeyh", k = 2
Output
2
# Example 2
Input
s = "abba", k = 1
Output
3
# Example 3
Input
s = "bcdf", k = 1
Output
0
Constraints
1 <= s.length <= 5 * 10^4
1 <= k <= 1000
s consists of only English lowercase letters.
Related LeetCode Problems
Practice more problems similar to Count Beautiful Substrings II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.