✅ [Java/C++] 100% Solution using Greedy (Minimum Sum of Four Digit Number After Splitting Digits)
Complexity\n- Time complexity: O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Ja
# Complexity\n- Time complexity: $$O(1)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Java Code\n```\nclass Solution {\n    public int minimumSum(int num) {\n        int[] digits = new int[4];\n        int i=0;\n        while(i<=3)\n        {\n            digits[i++] = num%10;\n            num/=10;\n        }\n        Arrays.sort(digits);\n        // digits[0] at ten\'s place and digits[2] at one\'s place makes the first number\n        // digits[1] at ten\'s place and digits[3] at one\'s place makes the second number\n        return digits[0]*10+digits[2]+digits[1]*10+digits[3];\n    }\n}\n```\n# C++ Code\n```\nclass Solution {\npublic:\n    int minimumSum(int num) {\n        int digits[4];\n        int i=0;\n        while(i<=3)\n        {\n            digits[i++] = num%10;\n            num/=10;\n        }\n        sort(digits,digits+4);\n        // digits[0] at ten\'s place and digits[2] at one\'s place makes the first number\n        // digits[1] at ten\'s place and digits[3] at one\'s place makes the second number\n        return digits[0]*10+digits[2]+digits[1]*10+digits[3];\n    }\n};\n```
['Math', 'Greedy', 'Sorting', 'C++', 'Java']