# First negative integer in every window of size k

Problem Link: <https://practice.geeksforgeeks.org/problems/first-negative-integer-in-every-window-of-size-k3345/1>

```python
def printFirstNegativeInteger( arr, n ,k):
    # code here
    i=0
    j=0
    
    ans=[]
    q=[]
    
    while(j<n):
        
        if(arr[j]<0):
            q.insert(0,arr[j])
        
        if(j-i+1<k):
            j+=1
        
        elif(j-i+1==k):
            
            if(len(q)==0):
                ans.append(0)
            else:
                ans.append(q[-1])
                
                if(arr[i]==q[-1]):
                    q.pop()
            
            i+=1
            j+=1
    
    return ans
```
