Problem 3397 · Medium

Maximum Number of Distinct Elements After Operations

Sort the values and give each one the smallest new value within k that is above the previous assignment.

Open the interactive visualisation