Problem 3874 · Medium

Valid Subarrays With Exactly One Peak

Mark the peaks, then count the subarrays whose only peak lies within k positions of both ends.

Open the interactive visualisation