IBM logoIBM
Coding·60 minMembers

Minimum Length Subarray with K Distinct Numbers

Members only

Given an integer list and `k`, return the minimum subarray length containing exactly or at least `k` distinct numbers, or `-1` when no such subarray exists.

SWE
sliding-window
hashmap
array
medium
Frequency
Single report
Last asked
2026-02-22
Stage
oa

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...