Count Distinct Elements In Every Window Of Size K
easy
1. You are given an array(arr) of integers and a number K. 2. You have to find the count of distinct numbers in all windows of size k.
Constraints
1 <= N <= 10^5 1 <= arr[i] <= 10^4 1 <= k <= N
Format
Input
A number N arr1 arr2.. N numbers A number K
Output
Space separated numbers representing the count of distinct numbers in all windows of size k.
Example
Sample Input
7
1 2 1 3 4 2 3
4
Sample Output
3 4 4 3
Question Video