C++ Greedy solution
Please, upvote if you like it. Thanks :-)ApproachUse a greedy approach.Complexity

Time complexity:
O(n log(n))


Space complexity:
O(1)

Code
Please, upvote if you like it. Thanks :-)

# Approach
Use a greedy approach.

# Complexity
- Time complexity:
O(n log(n))

- Space complexity:
O(1)

# Code
```cpp []
int minimizeSum(vector<int>& nums) {
    int n = nums.size();
    sort(begin(nums), end(nums));
    return min( { nums[n - 2] - nums[1],
                  nums[n - 1] - nums[2],
                  nums[n - 3] - nums[0] } );
}
```
['Array', 'Greedy', 'Sorting', 'C++']