Yet Another Array Problem
CodeChefOpen on judge ↗
You are given an array $A$, consisting of $N$ integers: $A_1,A_2,..., A_n$ . Your task is to find a segment $[l, r] $(1 ≤ l ≤ r ≤ n) such that among numbers $A_l,....,A_r$ there are exactly $k$ distinct numbers. ###Input: - The first line contains two space-separated integers: $N$ and $K$ (1 ≤ N,K ≤ 10^5). - The second line contains $N$ space-separated integers $A_1,A_2,..., A_n$ — elements of
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start