Very Easy Approach || C++✅
Code\npython3 []\nclass Solution:\n    def minMaxDifference(self, num: int) -> int:\n        n = str(num)\n                \n        small_map = n[0]\n        \
# Code\n```python3 []\nclass Solution:\n    def minMaxDifference(self, num: int) -> int:\n        n = str(num)\n                \n        small_map = n[0]\n        \n        big_map = ""\n        for i in n:\n            if (i != "9"):\n                big_map = i\n                break\n        \n        big = int(n.replace(big_map, "9") if big_map else n)\n        small = int(n.replace(small_map, "0"))\n\n        ans = (big-small)\n        return ans\n\n        \n```\n```C++ []\nclass Solution {\npublic:\n    int minMaxDifference(int num)\n    {\n        string s1 = to_string(num);\n        string s2 = to_string(num);\n        \n        int len = s1.size();\n        \n        char c1 = s1[0];\n        char c2 = s2[0];\n        \n        for(int i = 0; i < len; i++)\n        {\n            if(s1[i] != \'9\')\n            {\n                c1 = s1[i];\n                break;\n            }\n        }\n        \n        for(int i = 0; i < len; i++)\n        {\n            if(s1[i] == c1)\n            {\n                s1[i] = \'9\';\n            }\n        }\n        for(int i = 0; i < len; i++)\n        {\n            if(s2[i] == c2)\n            {\n                s2[i] = \'0\';\n            }\n        }\n        int mx = stoi(s1);\n        int mn = stoi(s2);\n        \n        int diff = (mx - mn);\n        \n        return diff;\n    }\n};\n```
['C++', 'Python3']