Largest Integer With Given Digit Sum
Fill the digits from the left with the largest digit that still fits the remaining sum; the result is the largest number of at most n digits with that digit sum.
Fill the digits from the left with the largest digit that still fits the remaining sum; the result is the largest number of at most n digits with that digit sum.