Problem 2182 · Medium

Construct String With Repeat Limit

Build the largest string from given letters while never repeating a letter more than a set number of times in a row. The visual greedily takes the largest available letter and inserts a smaller one when the limit is reached.

Open the interactive visualisation