(This question is a variation of the LeetCode question 76. Minimum Window Substring. If you haven't completed that question yet, it is recommended to solve it first.)
Given an array arr of n positive integers and an integer k, a subarray is considered good if it contains at least k distinct integers. Find the minimum length of a good subarray. If no good subarray exists, return -1.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected