values and an integer kinds. Count the non-empty windows of the array (runs of consecutive elements) that contain **exactly** kinds distinct values.
Windows at different positions count separately, even if they hold the same numbers.values=[2, 1, 2, 3], kinds=2 → 4
Exactly two distinct values appear in [2, 1], [1, 2], [2, 3] and [2, 1, 2].
values=[3, 3, 3], kinds=1 → 6
Each of the six windows is made of 3s only.
values=[1, 2, 1], kinds=3 → 0
The array has only two distinct values, so three is out of reach.
len(values) ≤ 2·10⁴values[i] ≤ len(values)kinds ≤ len(values)values=[2, 1, 2, 3], kinds=2
4
Run checks the first 3 tests in your browser. Submit checks all 116 tests on the server, hidden ones included.