Shortest Subarray with At Least K Distinct Integers

Given an array arr of n positive integers and an integer k.

A contiguous subarray is called good if it contains at least k distinct integer values.

Return the minimum length of a goo...

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: