Problem 1881 · Medium

Maximum Value after Insertion

Insert the digit x into a signed decimal string to get the largest possible value. The visual scans the digit slots left to right, sliding x into the first spot where it beats the digit it meets.

Open the interactive visualisation