Sliding Window Target: 15s
Monotonic deque keeps the running maximum in O(1) per step. Key for window-maximum.
from collections import deque
d = deque()
for i, x in enumerate(a):
while d and a[d[-1]] <= x: d.pop()
d.append(i)
if d[0] <= i - k: d.popleft()
Type it from memory. Go.