Python short and clean.
Approach\nWe are allowed to replace one of the 10 possible digits to other.\n\n1. Min number can be formed by replacing the first digit, and all other occurence
# Approach\nWe are allowed to replace one of the 10 possible digits to other.\n\n1. Min number can be formed by replacing the `first digit`, and all other occurences of it, with `0`.\n\n2. Max number can be formed by replacing the `first non 9 digit`, and all other occurences of it with `9`.\n\n3. Return the difference between max and min possible numbers.\n\n# Complexity\n- Time complexity: $$O(k)$$\n\n- Space complexity: $$O(k)$$\n\nwhere, `k is number of digits in num`.\n\n# Code\n```python\nclass Solution:\n    def minMaxDifference(self, num: int) -> int:\n        s_num = str(num)\n\n        ch = s_num[0]\n        min_num = int(s_num.replace(ch, \'0\'))\n\n        ch = next((x for x in s_num if x != \'9\'), \'0\')\n        max_num = int(s_num.replace(ch, \'9\'))\n\n        return max_num - min_num\n\n\n```
['Math', 'String', 'Python', 'Python3']