Problem 3041 · Medium

Maximize Consecutive Elements in an Array After Modification

Sort the values, then track the longest consecutive run ending at each value, allowing each element to stay or grow by 1.

Open the interactive visualisation