Problem 3834 · Medium

Merge Adjacent Equal Elements

Use a stack: each new value merges with equal tops, and a merge can cascade to the left.

Open the interactive visualisation