Take it easy
\n\n# Code\njava []\nclass Solution {\n    public int minMaxDifference(int num) {\n        String ns = String.valueOf(num);\n        char mxr=\'\n,mnr=\'\n;\n  
\n\n# Code\n```java []\nclass Solution {\n    public int minMaxDifference(int num) {\n        String ns = String.valueOf(num);\n        char mxr=\'\n```,mnr=\'\n```;\n        int i = 0;\n        while(i<ns.length()){\n            if((mxr=ns.charAt(i++))!=\'9\'){\n                break;\n            }\n        }\n        i=0;\n        while(i<ns.length()){\n            if((mnr=ns.charAt(i++))!=\'0\'){\n                break;\n            }\n        }\n        int max = Integer.parseInt(ns.replaceAll(String.valueOf(mxr),"9"));\n        int min = Integer.parseInt(ns.replaceAll(String.valueOf(mnr),"0"));\n        return max - min;\n    }\n}\n```
['Java']