Problem 3520 · Hard
Binary search the threshold; for each guess count the index pairs whose descending gap fits under it.
Open the interactive visualisation