First Negative Number in every Window of Size K (Java Solution)

 There are 3 approach to solve this problem :

  • Brute Force 
    • Time complexity - O (nk)

  • Using list to store element with sliding window approach
    • Time complexity - O(n)
    • Auxiliary space - O(k) 

  • Using sliding window approach without list
    • By traversing array from reverse.
    • Time complexity - O(n)





Comments

Popular posts from this blog

Sliding Window Maximum (Maximum of all subarrays of size k) - Java Solution - Leetcode 239

Count occurrence of anagrams in String