
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
For the given <code>k</code> find all the <code>x</code> integers such that <code>x^2 % k == 0</code>. Notice, that there aren’t many such candidates.
We can iterate over all such <code>x</codes> values and count the number of substrings such that <code>vowels == consonants == x</code>.
This can be done with prefix sums and hash map.