Maximum Difference By Remapping A Digit
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def minMaxDifference(self, num: int) -> int:\n        s = str(num)\n        mi = int(s.replace(s[0], \'0\'))\n        for c in s:\n            if c != \'9\':\n                return int(s.replace(c, \'9\')) - mi\n        return num - mi\n```
['Python3']