Ezvor

2067. Number of Equal Count Substrings

MediumHash Table Preparing judge… LeetCode
Hash TableStringSliding WindowCounting

Hints

Hint 1
The brute force solution is to check every substring, which would TLE. How can we improve this solution?
Hint 2
In an equal count substring, the first character appears count times, the second character appears count times, and so on.
Hint 3
The length of an equal count substring is the number of unique characters multiplied by count.
Hint 4
The length of all equal count substrings are multiples of count.