Problem 3835 · Hard

Count Subarrays With Cost Less Than or Equal to K

Cost is the value spread times the length; a window that fits stays fit inside any sub-window.

Open the interactive visualisation