Problem 689 · Hard
Precompute the best window to each side of every position; the middle window then picks its best pair.
Open the interactive visualisation