For this Question: Given an array of N integers and an integer K, your task is to print the number of distinct elements present in every window of size K.First line of input contains two space- separated integers N and K, the next line contains N space- separated integers depicting the values of the array.

Constraints:-
1 <= K <= N <= 100000
1 <= Arr[i] <= 1000Print (N- K+1) integers, the number of distinct elements for all window of size K.Sample Input:-
6 3
1 2 3 2 2 3

Sample Output:-
3 2 2 2

Explanation:
for the 1st window of size 3, elements are: 1 2 3
thus the number of distinct elements would be: 3
Similarly, for the 2nd window: 2
3rd window: 2
4th window: 2

Sample Input:-
6 4
1 2 3 3 2 1

Sample Output:-
3 2 3, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder result=new StringBuilder();
		String constraints[]=br.readLine().trim().split(" ");
		int N=Integer.parseInt(constraints[0]);
		int K=Integer.parseInt(constraints[1]);
		String input[]=br.readLine().trim().split(" ");
		Map<String,Integer> myMap=new HashMap<>();
		for(int i=0;i<K;i++){
			if(myMap.containsKey(input[i])){
				int temp=myMap.get(input[i]);
				myMap.replace(input[i],temp+1);
			}
			else
				myMap.put(input[i],1);
		}
		result.append(myMap.size()+" ");
		int leftIndex=0;
		for(int i=K;i<N;i++){
			int temp=myMap.get(input[leftIndex]);
			if(temp==1)
				myMap.remove(input[leftIndex]);
			else
				myMap.replace(input[leftIndex],temp-1);
			if(myMap.containsKey(input[i])){
				temp=myMap.get(input[i]);
				myMap.replace(input[i],temp+1);
			}
			else
				myMap.put(input[i],1);
			result.append(myMap.size()+" ");
			leftIndex++;
		}

		System.out.println(result.toString());

	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?