Easy, Best C++ Solution || Beginner level ----
\n\n# Code\n\nclass Solution {\npublic:\n    int minMaxDifference(int number) {\n        string num1= to_string(number);\n        string num2=to_string(number);
\n\n# Code\n```\nclass Solution {\npublic:\n    int minMaxDifference(int number) {\n        string num1= to_string(number);\n        string num2=to_string(number);\n        \n        char c=num1[0],ch=num1[0];\n        \n        for(int i=0; i<num1.size(); i++)\n        {\n            if(num1[i]!=\'9\'){\n                c=num1[i];\n                break;\n            }\n        }\n        \n        for(int i=0; i<num1.size(); i++)\n        {\n            if(num1[i]==c) num1[i]=\'9\';\n        }\n        \n        for(int i=0; i<num1.size(); i++)\n        {\n            if(num2[i]==ch) num2[i]=\'0\';\n        }\n        \n        int max_num=stoi(num1);\n        int min_num=stoi(num2);\n        return max_num -min_num;\n    }\n};\n```
['C++']