Problem 3597 · Medium

Partition String

Cut a string from left to right: keep growing the current piece until it differs from every piece already kept, then keep it and start the next piece. Return the kept pieces in order.

Open the interactive visualisation