Very Simple and Easy Solution
\n\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string s =to_string(num), large = to_string(num), small = to_string(num);\n        c
\n```\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string s =to_string(num), large = to_string(num), small = to_string(num);\n        char dl = -1, ds = -1;\n        for(int i = 0; i < s.size(); ++i){\n            if(dl == -1 && s[i] != \'9\'){\n                dl = s[i];\n                large[i] = \'9\';\n            }else {\n                large[i] = (s[i] == dl)?\'9\': s[i];\n            }\n            \n            if(ds == -1 && s[i] != \'0\'){\n                ds = s[i];\n                small[i] = \'0\';\n            }else{\n                small[i] = (s[i] == ds)?\'0\':s[i];\n            }\n        }\n        return stoi(large) - stoi(small);\n    }\n};\n\n```\n\nHere is an article of my recent interview experience - A Journey to FAANG Company, I recomand you to go through this to know which all resources I have used & how I cracked interview at Amazon:\nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted
['C++']