My solution is very big.
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
     int maxi(int n) //For maximum number
 {
    //Converting into maximum number 
     
    vector<int> v;
    while(n){
         v.push_back(n%10);
         n /= 10;
    }
    //Reversing
    reverse(v.begin(), v.end());
     int n1;
  

     
     //Finding a digit to change
    for(int i=0; i<v.size(); i++)
    {
         if(v[i] != 9)  {
             n1 = v[i];
             break;
         }
    }

     

    //Changing digit in the array

    for(int i=0; i<v.size(); i++)  if(v[i] == n1) v[i] = 9;

    
    //Converting array into integer
     
     int num = 0;
    for(int i =0; i<v.size(); i++){
          num = num*10 + v[i];
           
    }

    return num;


 }
     int mini(int n) //For minimum number
 {
    //Converting into minimum number 
     
    vector<int> v;
    while(n){
         v.push_back(n%10);
         n /= 10;
    }
    //Reversing
    reverse(v.begin(), v.end());
     int n1 = v[0];
  
    //Changing digit in the array

    for(int i=0; i<v.size(); i++)  if(v[i] == n1) v[i] = 0;

    
    //Converting array into integer
     
     int num = 0;
    for(int i =0; i<v.size(); i++){
          num = num*10 + v[i];
           
    }

    return num;


 }
public:
    int minMaxDifference(int n) {
         return maxi(n) -  mini(n);
    }
};
```
['C++']