SIMPLE || C++
\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string str = to_string(num);\n        string s1,s2;\n        s1 = str;\n        s2 = s
```\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string str = to_string(num);\n        string s1,s2;\n        s1 = str;\n        s2 = str;\n        int i;\n        for(i = 0; i < s1.length(); i++)\n            if(s1[i] != \'9\')break;\n        if(i==s1.length()){\n            return num;\n        }\n        char c = s1[i];\n        char c1 = s1[0];\n        // cout<<c<<" "<<c1<<" ";\n        for(i = 0; i < s1.length(); i++){\n            if(s1[i]==c){\n                s1[i] = \'9\';\n            }\n            if(s2[i]==c1){\n                s2[i] = \'0\';\n            }\n        }\n        // cout<<s1<<" "<<s2<<endl;\n        return (stoi(s1)-stoi(s2));\n    }\n};\n```
['Array', 'Math', 'C', 'C++']