easy C++ solution for Minimum Sum of Four Digit Number After Splitting Digits
Intuition\nit\'s just a two pointers technique\n\n# Approach\nsort and try to get min member int top left and max at top right ...\n# Complexity\n- Time complex
# Intuition\nit\'s just a two pointers technique\n\n# Approach\nsort and try to get min member int top left and max at top right ...\n# Complexity\n- Time complexity:\nO(n logn)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumSum(int num) {\n\n        ios::sync_with_stdio(false);\n        cin.tie(nullptr);\n        cout.tie(nullptr);\n        string temp = to_string(num);\n\n        sort(temp.begin(), temp.end());\n\n        int left = 0, right = temp.length() - 1;\n\n        int sum = 0;\n\n        while (left < right) {\n            sum += (temp[left] - \'0\') * 10 + (temp[right] - \'0\');\n            left++;\n            right--;\n        }\n\n        if (left == right)\n            sum += temp[left] - \'0\';\n\n        return sum;\n    }\n};\n\n```
['C++']