Available question text
Count the non-empty substrings where vowels == consonants and their product is divisible by k; since equality implies length 2t with t vowels, the problem reduces to counting substrings of length 2t that contain exactly t vowels for every t with t^2 % k == 0. Efficient solutions combine enumerating valid t (up to n/2) with prefix sums or sliding-window counting to handle strings up to 5·10^4.
Related questions
Continue with questions that share topics or the same question type.
- Count Beautiful Substrings I
Coding
- Count Beautiful Numbers
Coding
- Count Beautiful Splits in an Array
Coding
- Count Binary Substrings
Coding · String · Two Pointers
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2949. Count Beautiful Substrings II
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source