Problem 3853 · Medium

Merge Close Characters

Repeatedly merge pairs of equal letters at most k positions apart in the current string by deleting the right one, always choosing the lowest left position first, then the lowest right position. Return the final string.

Open the interactive visualisation