Problem 3081 · Medium

Replace Question Marks in String to Minimize Its Value

Each new letter costs its current count, so fill each question mark with the least used letter, then place the chosen letters in sorted order.

Open the interactive visualisation