Maximum Of Min Numbers In K Sized Subarrays

easy
1. Given an integer array A[] of size N. 
  2. Find the minimum of every window size in the array.
  3. Return the max of such min values.    
  4. The window size grows from 1 to N.

Input Format

First line contains an integer N denoting the size of array. Second line contains N space-separated integers A1, A2, ..., AN denoting the elements of the array.

Output Format

Print the array of numbers of size N for each of the considered window size 1, 2 , ..., N respectively.

Constraints

1 <= N <= 105
  1 <= A[i] <= 106

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
7
10 20 30 50 10 70 30
Output
0 0 0 0 0 0 0
Previous
Long Parenthesis
Next
Driving A Mustang!

Related Questions