LeetCode
Subarrays with K Different Integers
Click
here
for an explanation.