Problem 3746 · Medium

Minimum String Length After Balanced Removals

Track a running a-minus-b balance; the letters left over after balanced removals are exactly the final imbalance.

Open the interactive visualisation