# [2259\. Remove Digit From Number to Maximize Result](https://leetcode.com/problems/remove-digit-from-number-to-maximize-result/) :::spoiler Hint ```cpp= ``` ::: :::spoiler Solution ```cpp= class Solution { public: string removeDigit(string number, char digit) { string res; for (int i = 0; i < number.size(); i++) { if (number[i] == digit) { string temp = number.substr(0, i) + number.substr(i + 1, number.size()); res = max(res, temp); } } return res; } }; ``` - T: $O(n)$ - S: $O(1)$ :::
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up