0992. Subarrays with K Different Integers
https://leetcode.com/problems/subarrays-with-k-different-integers
Description
Given an integer array nums
and an integer k
, return the number of good subarrays of nums
.
A good array is an array where the number of different integers in that array is exactly k
.
For example,
[1,2,3,1,2]
has3
different integers:1
,2
, and3
.
A subarray is a contiguous part of an array.
Example 1:
Example 2:
Constraints:
1 <= nums.length <= 2 * 104
1 <= nums[i], k <= nums.length
ac
Last updated