#3859

Count Subarrays With K Distinct Integers

hard · 17.9% accepted · 63 likes · top 1%

Description

You are given an integer array nums and two integers k and m.

Return an integer denoting the count of subarrays of nums such that:

- The subarray contains exactly k distinct integers.

- Within the subarray, each distinct integer appears at least m times.

Solution