The closest widely available problem matching your description is “Smallest subarray with k distinct numbers,” which is a sliding-window, array, hash-table problem and appears in interview-prep lists for major companies, but the specific Adobe-labeled problem “Minimum Subarray with K Distinct Integers” on HackTheRounds is paywalled and does not expose its full statement, examples, or constraints publicly. Because of that, we cannot retrieve or reconstruct its exact official wording or test set; we can only use open versions of the same underlying problem.[1]
A fully visible version of this problem is given as:
You are given an array of $$n$$ integers and an integer $$k$$. Find the smallest subarray $$[l, r]$$ (both $$l$$ and $$r$$ inclusive) such that there are exactly $$k$$ different numbers in this subarray. If no such subarray exists, print $$-1$$. If multiple subarrays meet the criteria, return the one with the smallest starting index.
This matches your tags: Array (array of integers), Hash Table (map/set to count distinct), Sliding Window (two-pointer window maintained over the array).
The GeeksforGeeks statement provides the task in narrative form; its examples make the expected I/O behavior clear.
Examples:
arr[] = {1, 1, 2, 2, 3, 3, 4, 5}, k = 35 7arr[] = {1, 2, 2, 3}, k = 20 1arr[] = {1, 1, 2, 1, 2}, k = 3Invalid k or -1In the same article, the implementations print -1 when no such subarray exists (rather than the text “Invalid k”), so you should expect the canonical behavior to be to output -1 in that case.
Typical competitive-programming style formats this as:
-1 if no such subarray exists.Because the Adobe/HackTheRounds problem is not publicly visible, its exact input format (0-based vs 1-based indices, error string vs -1) may differ, but the underlying behavior (minimum-length subarray with exactly $$k$$ distinct values, tie-breaking by smallest start) aligns with the version above.[1]
The article provides two approaches (naive $$O(n^2)$$ and expected sliding-window $$O(n)$$), and describes time and space expectations rather than explicit numeric bounds. From the use of a linear-time sliding window with hash map and from typical GeeksforGeeks constraint patterns, reasonable implied constraints are:
arr are integers (examples use small positive integers, but the algorithm handles arbitrary integer values).No stricter numeric ranges (like $$n \le 2 \cdot 10^5$$) are explicitly stated in the open statement.
The HackTheRounds Adobe question list only shows the title “Minimum Subarray with K Distinct Integers” with meta-info (difficulty and round), and the actual statement and examples are behind a logged-in/paywalled “PRO” section. That means:[1]
If you need to prepare for this interview question, you can confidently study and implement the “Smallest subarray with k distinct numbers” problem as described above, using an array + hash map + sliding window solution; this matches the same core problem and expected approach.