Video Solution - Very Simple Solution || C++
Video Solution\nhttps://youtu.be/BzMJP_EvGSI\n\n# Code\n\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string s = to_string(num);\n  
# Video Solution\nhttps://youtu.be/BzMJP_EvGSI\n\n# Code\n```\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string s = to_string(num);\n        \n        int id=0;\n        char c = s[0];\n        for(int i=0;i<s.length();i++){\n            if(s[i] != \'9\'){\n                c = s[i];\n                id= i;\n                break;\n            }\n        }\n        \n        string s1 = "";\n        for(int i=0;i<s.length();i++){\n            if(s[i] == c){\n                s1 += \'9\';\n            }else{\n                s1 += s[i];\n            }\n        }\n        // cout<<s1<<endl;\n        \n        string s2 = "";\n        for(int i=0;i<s.length();i++){\n            if(s[i] == s[0]){\n                s2 += \'0\';\n            }else{\n                s2 += s[i];\n            }\n        }\n        \n        // cout<<s2<<endl;\n        \n        int val1 = stoi(s1);\n        int val2 = stoi(s2);\n        \n        return (val1-val2);\n    }\n};\n```
['C++']