Problem 2434 · Medium

Using a Robot to Print the Lexicographically Smallest String

Hold characters on a stack and print the top whenever it is no larger than every character still unread.

Open the interactive visualisation