Finding Negative Value In Ksize Window

easy
1. Given an array and a positive integer k
 2. Print the earliest(first) negative integer for each and every window(contiguous subarray) of size k.    
 3. If there is no negative number in a window print 0.

Input Format

First line contains size of array 'N' Second line contain N integer elements of array Third line contains integer value k(size of window)

Output Format

Print the earliest negative number for every successive window in order.

Constraints

1<=N<=10^5
 1<=A[i]<=10^5
 1<=k<=N

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
8
12 -1 -7 8 -15 30 16 28
3
Output
-1 -1 -7 -15 -15 0
Previous
Driving A Mustang!
Next
Find The Next Larger Element

Related Questions