Subarray with K Distinct Integers

Given an integer array and an integer k, find the size of the smallest subarray that contains k distinct integers.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: