</>OfferRetriever
DashboardDiscuss
NEW

July 4th Sale

Limited Time Deal: Unlock all premium questions for over 40% off

$10.42$6.25

10

:

09

:

27

:

47

Get this deal
Back to Dashboard

Digit Replacement Maximizer

Medium

A numeric optimization system performs exactly k substitution operations on a number string s. In each operation, choose any digit in s that is not "7" and replace it with "7". Find the largest possible number after performing exactly k operations.

If it is impossible to perform exactly k operations (because there are fewer than k non-"7" digits), return an empty string. ...