Subarrays with K Different Integers
Example
Input:
A = [1,2,1,2,3], K = 2
Output:
7
Explanation:
Subarrays formed with exactly 2 different integers: [1,2], [2,1], [1,2], [2,3], [1,2,1], [2,1,2], [1,2,1,2].Input:
A = [1,2,1,3,4], K = 3
Output: 3
Explanation:
Subarrays formed with exactly 3 different integers: [1,2,1,3], [2,1,3], [1,3,4].Note
Code
Last updated