Easiest Simple Soln
\n\n# Code\n\nclass Solution {\n    public int minMaxDifference(int num) {\n        String s=""+num;\n        char[] ch=s.toCharArray();\n        char minchar=\
\n\n# Code\n```\nclass Solution {\n    public int minMaxDifference(int num) {\n        String s=""+num;\n        char[] ch=s.toCharArray();\n        char minchar=\'9\';\n         for (char c : ch) {\n            if (c != minchar) {\n                minchar = c;\n                break;\n            }\n        }\n        for(int i=0;i<ch.length;i++){\n            if(ch[i]==minchar){\n                ch[i]=\'9\';\n            }\n        }\n        String mstr=new String(ch);\n        int maxx=Integer.parseInt(mstr);\n\n\n        char[] chr=s.toCharArray();\n        char maxchar=\'0\';\n        for(char c:chr){\n            if(c!=maxchar){\n                maxchar=c;\n                break;\n            }\n        }\n        for(int i=0;i<chr.length;i++){\n            if(chr[i]==maxchar){\n                chr[i]=\'0\';\n            }\n        }\n        String mstrr=new String(chr);\n        int minn=Integer.parseInt(mstrr);\n\n        return maxx-minn;\n\n\n    }\n}\n```
['Java']