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
Post a Comment