Easy Simple C++ Solution
Approach\nHere\'s how the code works:\n\n- It initializes an empty vector arr to store the digits of num.\n\n- The while loop extracts the digits of num one by 
# Approach\nHere\'s how the code works:\n\n- It initializes an empty vector arr to store the digits of num.\n\n- The while loop extracts the digits of num one by one by taking the modulo 10 (num % 10) to get the last digit and pushing it into the vector arr. Then, it divides num by 10 (num = num / 10) to remove the last digit.\n\n- After the loop finishes, the vector arr contains the individual digits of num in reverse order.\n\n- The sort function is used to sort the vector arr in ascending order.\n\n- Two variables, new1 and new2, are initialized to store the values of the rearranged numbers.\n\n- The first rearranged number, new1, is formed by concatenating the smallest digit (arr[0]) with the third smallest digit (arr[2]). The digits are multiplied by 10 to shift their positions accordingly.\n\n- The second rearranged number, new2, is formed by concatenating the second smallest digit (arr[1]) with the fourth smallest digit (arr[3]).\n\n- Finally, the sum of new1 and new2 is returned as the result.\n\n**Note**: The given code assumes that num has 4 digits as given in question.\n\n---\n\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumSum(int num) {\n        vector<int> arr;\n        while(num){\n            arr.push_back(num%10);\n            num = num/10;\n        }\n        sort(arr.begin(),arr.end());\n        int new1=0,new2=0;\n        new1 = 10*arr[0]+arr[2];\n        new2 = 10*arr[1]+arr[3];\n        return new1+new2;\n    }\n};\n```
['Array', 'Math', 'Greedy', 'Sorting', 'C++']