C# simple solution | 1ms beats 100%
\n\n\n# Code\ncsharp []\npublic class Solution {\n    public int MinMaxDifference(int num) {\n        var s=num.ToString();\n        int max=0, min=int.Parse(s.
![image.png](https://assets.leetcode.com/users/images/2d5ff067-0e37-4c0d-b7ac-71878038555a_1729492699.9396513.png)\n\n\n# Code\n```csharp []\npublic class Solution {\n    public int MinMaxDifference(int num) {\n        var s=num.ToString();\n        int max=0, min=int.Parse(s.Replace($"{s[0]}","0"));\n        int i=0;\n        while(i<s.Length){\n            if(s[i]<\'9\')break;\n            i++;\n        }\n        if(i==s.Length)max=num;\n        else max=int.Parse(s.Replace($"{s[i]}","9"));\n        return max-min;        \n    }\n}\n```
['C#']