Simple C++ Solution || Easy to Understand.
----------------------------------------------------------------------\nSolution: 1\n\n----------------------------------------------------------------------\n\
----------------------------------------------------------------------\n**Solution: 1**\n\n----------------------------------------------------------------------\n```\nclass Solution {\npublic:\n    int minimumSum(int num) {\n        string str = to_string(num);\n        sort(str.begin(),str.end());\n\n        int ans = (str[0]-\'0\' + str[1]-\'0\')*10 + str[2]-\'0\' + str[3]-\'0\';\n        return ans;\n    }\n};\n```\n----------------------------------------------------------------------\n\n**Solution: 2**\n```\nclass Solution {\npublic:\n    int minimumSum(int num) {\n        vector<int> v;\n\n        while(num!=0)\n        {\n            int rem = num%10;\n            v.push_back(rem);\n            num /= 10;\n        }\n\n        sort(v.begin(),v.end());\n\n        int num1 = v[0]*10+v[3];\n        int num2 = v[1]*10+v[2];\n\n        int ans = num1+num2;\n        return ans;\n    }\n};\n```\n\n----------------------------------------------------------------------\n**Analysis:**\n\n----------------------------------------------------------------------\n\n**Time Complexity:** ```O(NlogN)``` ----> As we used the sort function to sort the array.\n**Space Complexity**: ```O(n)```     ----> As we created the external Vector.\n\n----------------------------------------------------------------------\nIf this solution, helps you then please ```Upvote.```\ntill then **Keep Learning, Keep Exploring!!!**\n\n\n$$Thank You!$$\n\n----------------------------------------------------------------------\n\n\n
['C++']