Back

array sliding window problem any one help me to solve it

Created 3 years ago
60 Views
1 Comments
SohelShaikh
@SohelShaikh
SohelShaikh
@SohelShaikhProfile is locked. Login

Assume you are a student studying in school.You are given a task to find first negative integer for each and every window of size k.

Input Description:
First line contains an integer n denoting the size of the array. The next line contains n space separated integers forming the array. The last line contains the window size k.

Output Description:
Print the first negative integer in that window.If all the numbers are positive print 0

Sample Input :
7
1 -2 -3 -4 5 6 -7
3
Sample Output :
-2 -2 -3 -4 -7
Comments
Please login to comment.