Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How to check efficiently each K-length substring?
First store the first leftmost K-length substring in a hashTable or array of frequencies.
Then iterate through the rest of characters and erase the first element and add the next element from the right. If in the hashTable we have K different character we add 1 to the counter. After that return as answer the counter.