🔥💯✅Easy Solution in C++💯✅
Complexity\n- Time complexity:\nO(n) where n is the total number of digits in num\n\n- Space complexity:\nO(1)\n\n# Code\n### PLease Upvote if u liked my Soluti
# Complexity\n- Time complexity:\nO(n) where n is the total number of digits in num\n\n- Space complexity:\nO(1)\n\n# Code\n### **PLease Upvote if u liked my Solution\uD83E\uDD17**\n```\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string s=to_string(num),g=s;\n        int n=s.size();\n        char ch=1;\n        for(int i=0;i<n;i++){\n            if(ch==1 && s[i]!=\'9\'){\n                ch=s[i];\n                s[i]=\'9\';\n            }\n            else if(ch!=1 && s[i]==ch)\n                s[i]=\'9\';\n        }\n        ch=1;\n        for(int i=0;i<n;i++){\n            if(ch==1 && g[i]!=\'0\'){\n                ch=g[i];\n                g[i]=\'0\';\n            }\n            else if(ch!=1 && g[i]==ch)\n                g[i]=\'0\';\n        }\n        return stoi(s) - stoi(g);\n    }\n};\n```
['C++']