Problem 1663 · Medium

Smallest String With A Given Numeric Value

Build the lexicographically smallest string of a fixed length whose letter values sum to a target. The visual fills positions from the end, placing the largest letter that still leaves room for the rest.

Open the interactive visualisation