For this Question: Given an integer array A[] of size N. For any subarray size i (1 <= i <= N), you have to do the following:
<ul><li>Write all subarrays of size i from array A on a piece of paper.</li><li>Now, replace each of these subarrays with their minimum element.</li><li>Now, find the maximum value among all these minimums.</li>
Print this maximum value for all subarray sizes k (1 <= k <= N).The first line contains an integer N denoting the size of the array. The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of the array.

Constraint:-
1 <= N <= 10^5
1 <= A[i] <= 10^6Print the array of numbers of size N for each of the considered window size 1, 2, ..., N respectively.Sample Input: 
7
10 20 30 50 10 70 30

Sample Output: 
70 30 20 10 10 10 10 

Explanation:
Testcase 1:
First element in output indicates maximum of minimums of all windows of size 1. Minimums of windows of size 1 are {10}, {20}, {30}, {50}, {10}, {70} and {30}. Maximum of these minimums is 70.
Second element in output indicates maximum of minimums of all windows of size 2. Minimums of windows of size 2 are {10}, {20}, {30}, {10}, {10}, and {30}. Maximum of these minimums is 30.
Third element in output indicates maximum of minimums of all windows of size 3. Minimums of windows of size 3 are {10}, {20}, {10}, {10} and {10}. Maximum of these minimums is 20.
Similarly other elements of output are computed., 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));
		int n = Integer.parseInt(br.readLine());
		String s= br.readLine();
		String[] str = s.split(" ");
        int arr[] = new int[n];
        for(int i=0 ; i<n ; i++){
            arr[i]=Integer.parseInt(str[i]) ;
        }

		printMaxOfMin(n,arr);
	}
	static void printMaxOfMin(int n,int[] arr)
    {

        Stack<Integer> s = new Stack<>();


        int left[] = new int[n+1];
        int right[]  = new int[n+1];


        for (int i=0; i<n; i++)
        {
            left[i] = -1;
            right[i] = n;
        }



        for (int i=0; i<n; i++)
        {
            while (!s.empty() && arr[s.peek()] >= arr[i])
                s.pop();

            if (!s.empty())
                left[i] = s.peek();

            s.push(i);
        }



        while (!s.empty())
            s.pop();


        for (int i = n-1 ; i>=0 ; i-- )
        {
            while (!s.empty() && arr[s.peek()] >= arr[i])
                s.pop();

            if(!s.empty())
                right[i] = s.peek();

            s.push(i);
        }


        int ans[] = new int[n+1];
        for (int i=0; i<=n; i++)
            ans[i] = 0;



        for (int i=0; i<n; i++)
        {

            int len = right[i] - left[i] - 1;




            ans[len] = Math.max(ans[len], arr[i]);
        }



        for (int i=n-1; i>=1; i--)
            ans[i] = Math.max(ans[i], ans[i+1]);


        for (int i=1; i<=n; i++)
            System.out.print(ans[i] + " ");
    }

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