C++ | Python - Short and easy to understand with sorting
Intuition\nWe see that we have to sort the array to easily find low score and high score\n\n# Approach\nAfter sorting the array, we have 3 ways to optimize this
# Intuition\nWe see that we have to sort the array to easily find **low** score and **high** score\n\n# Approach\nAfter sorting the array, we have 3 ways to optimize this problem:\n- Increase `nums[0], nums[1] equal to nums[2]`, now `low=0`,  `high=nums[n-1]-nums[2]`\n- Reduce `nums[n-1], nums[n-2] equal to nums[n-3]`, now `low=0`, `high=nums[n-3]-nums[0]`\n- Increase `nums[0] equal to nums[1]`, `nums[n-1] equal to nums[n-2]`, now `low=0`, `high=nums[n-2]-nums[1]`\n\nSo we just need to choose the smallest **high** score\n\n# Complexity\n- Time complexity: O(NlogN)\n\n# Code\n## C++\n```C++\nclass Solution {\npublic:\n    int minimizeSum(vector<int> &nums) {\n        std::sort(nums.begin(), nums.end());\n        int n = nums.size();\n        return min({nums[n - 1] - nums[2], nums[n - 3] - nums[0], nums[n - 2] - nums[1]});\n    }\n};\n```\n## Python\n```python\nclass Solution:\n    def minimizeSum(self, nums: List[int]) -> int:\n        nums.sort()\n        return min(nums[-1] - nums[2], nums[-3] - nums[0], nums[-2] - nums[1])\n```\n\t\t
['C', 'Sorting']