Problem 3837 · Medium
Sweep from the right while a running tally holds only the values at least k plus one places ahead.
Open the interactive visualisation