---
# System prepended metadata

title: number of substrings with exactly k distinct character

---

# number of substrings with exactly k distinct character

## question
https://leetcode.com/discuss/interview-question/370157
It allow duplicated subtrings!!!


## h2
not correct for duplicated substring
https://leetcode.com/playground/mE4gukYF

## h2
not correct for duplicated substring
but a good skeleton
https://www.geeksforgeeks.org/count-number-of-substrings-with-exactly-k-distinct-characters/

