🚀 Simple🚀 Greedy🚀 Math 🚀Easy 🚀 Python 🚀Python3 🚀
Please Upvote if you find this useful \uD83D\uDE0A\n\n\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:
### Please Upvote if you find this useful \uD83D\uDE0A\n\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minMaxDifference(self, num: int) -> int:\n        lst = list(str(num))\n        minN = lst[0]\n        maxN = lst[0]\n        num1 = list()\n        num2 = list()\n        \n        for i in lst:\n            if i != \'9\':\n                minN = i\n                break\n\n        for i in range(len(lst)):\n            if lst[i] == minN:\n                num2.append(\'9\')\n            else:\n                num2.append(lst[i])\n            if lst[i] == maxN:\n                num1.append(\'0\')\n            else:\n                num1.append(lst[i])\n\n        return int("".join(num2)) - int("".join(num1))\n```\n\n### Please Upvote if you find this useful \uD83D\uDE0A\n
['Greedy', 'Python', 'Python3']