For this Question: You are given an array A of size N. You have to print the maximum in every <b>K-sized subarray</b> from the left to the right in the array A.
More formally, you have to print N - K + 1 integers X<sub>1</sub>, X<sub>2</sub>, ..., X<sub>N-K+1</sub> such that X<sub>i</sub> (1 <= i <= N - K + 1) is the maximum element in the subarray A<sub>i</sub>, A<sub>i+1</sub>, ..., A<sub>i+K-1</sub>.1. The first line contains an integer N, denoting the size of the array.
2. The second line has N space-separated integers of the array A.
3. The third line contains integer K, denoting the size of the sliding window

<b>Constraints :</b>
1 &le; N &le; 10<sup>5</sup>
-10<sup>4</sup> &le; A[i] &le; 10<sup>4</sup>
1 &le; K &le; NPrint the max of K numbers for each position of sliding windowSample Input:-
8
1 3 -1 -3 5 3 6 7
3

Sample Output:-
3 3 5 5 6 7

Explanation:-
Window position       Max
- - - -
[1 3 -1] -3 5 3 6 7         3
1 [3 -1 -3] 5 3 6 7         3
1 3 [-1 -3 5] 3 6 7         5
1 3 -1 [-3 5 3] 6 7         5
1 3 -1 -3 [5 3 6] 7         6
1 3 -1 -3 5 [3 6 7]         7

Sample Input:-
1
1
1

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

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int n=Integer.parseInt(bu.readLine());
        String s[]=bu.readLine().split(" ");
        int a[]=new int[n],i;
        PriorityQueue<int[]> pq=new PriorityQueue<>(new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                if(o1[0]<o2[0]) return 1;
                else return -1;
            }});

        for(i=0;i<n;i++) a[i]=Integer.parseInt(s[i]);
        int k=Integer.parseInt(bu.readLine());
        for(i=0;i<k;i++) pq.add(new int[]{a[i],i});
        sb.append(pq.peek()[0]+" ");
        for(i=k;i<n;i++)
        {
            pq.add(new int[]{a[i],i});
            while(!pq.isEmpty() && pq.peek()[1]<=i-k) pq.poll();
            sb.append(pq.peek()[0]+" ");
        }
        System.out.println(sb);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?