number (it may be very long and may be negative, in which case it starts with -) and a digit digit between 1 and 9.
Insert digit anywhere in the written number so that the resulting value is as large as possible. The digit cannot go to the left of the minus sign.
Return the result as a string.number="7315", digit=4 → '74315'
It pays to place the digit just before the first digit smaller than 4, giving 74315.
number="-482", digit=5 → '-4582'
For a negative number the magnitude should be as small as possible: -4582 beats -5482, -4852 and -4825.
number="66", digit=6 → '666'
number is a valid integer with no leading zeros- followed by at least one digitnumber="7315", digit=4
'74315'
Run checks the first 3 tests in your browser. Submit checks all 127 tests on the server, hidden ones included.