Problem 3874 · Medium
Mark the peaks, then count the subarrays whose only peak lies within k positions of both ends.
Open the interactive visualisation