The window that starts at the spike
transcript
There is a spike at minute three. One window runs from three to five. Your code says no window covers it. Your code is wrong. Find out why.
The code asks if the window starts before the spike. A window starting at three is not before three. So the window never enters the search. Ask for at most the spike instead.
A window covers its first minute. It covers its last minute too. So equal is allowed on both sides. A strict test loses the equal case.
With the strict test, the answer is minus one. With the loose test, the answer is one. One window was always enough. The bug hid a valid answer.
Always test a spike at a window start. Then test a spike at a window end. Boundary tests catch this in seconds. Write them before you trust any cover loop.
Use at most, not less than. Test spikes on the ends. Full breakdown in the lecture.