2259. Remove Digit From Number to Maximize Result
On This Page
class Solution:
def removeDigit(self, number: str, digit: str) -> str:
last = -1
n = len(number)
for i, d in enumerate(number):
if d == digit:
last = i
if i + 1 < n and d < number[i + 1]:
break
return number[:last] + number[last + 1 :]