Longest Affordable Streak — Solution & Editorial
Classic shrink-expand window: extend right, and while the sum exceeds K advance left. Positivity makes the window monotone.
Complexity: O(N)
Classic shrink-expand window: extend right, and while the sum exceeds K advance left. Positivity makes the window monotone.
Complexity: O(N)