Approach Summary
Expand the window and track zeros flipped. When zeros > k, shrink from the left.
How to Recognize This Pattern
- Flip at most k zeros
- Longest subarray of 1s
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(1)
Tags
Array Sliding Window Binary