Dsa
Hashing
Easy
Clean Signal Windows
A radio telescope captures a stream of integer frequencies. We are looking for 'clean windows' of size K. A window is 'clean' if every single frequency within that window is unique (no duplicates). Given the window size K and the stream of data, count the total number of clean windows.
Input Format:
- Line 1: Two integers, N (total elements) and K (window size).
- Line 2: N space-separated integers representing the stream.
Output Format:
- A single integer representing the count of clean windows.
Example:
Input:
5 3
1 2 1 3 4
Output:
2
(Explanation: Windows are [1,2,1], [2,1,3], [1,3,4]. Only [2,1,3] and [1,3,4] are clean.)
Key concepts
hashingsliding windowfrequency map
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now