Explained two solutions - with & without sorting || Very Simple & Easy to Understand
Up Vote if you like the solution \n\n# Approach\n\nFirst of all we can simply replace two numbers with the same value, that results in the lowest difference to 
Up Vote if you like the solution \n\n# Approach\n\nFirst of all we can simply replace two numbers with the same value, that results in the lowest difference to zero in all cases.\nSo now the problem statement becomes, high (max difference) should be lowest. \nSo to achieve this, we need to decrease the difference between the smallest and largest value. This further can be achieved by doing one out of these three cases :\n1. remove the smallest two numbers\n2. remove the largest two numbers\n3. remove the smallest and largest\n\nso considering above three cases we have to take the minimum value possible.\n\nNote: I have written remove the smallest/largest number, this means => changing the smallest/largest number to any other number in the array.\n\nTo find smallest two and largest two number we can simply sort the array and we will have the value. Another way can be just keep track of two smallest and two largest values in the array which can be done easily using priority queue or just by tracking smallest three and largest three variables.\n \n\n# Solution 1 : with Sorting\n```\n    int minimizeSum(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        int case1 = nums.back() - nums[2];\n        int case2 = nums[nums.size() - 3] - nums[0];\n        int case3 = nums[nums.size() - 2] - nums[1];\n        return min({case1, case2, case3});\n    }\n```\n\n# Solution 2: with out sorting\n```\n/*\nAfter sorting the order of the variables are as follows :\ns1, s2, s3 ......... l3, l2, l1\ns1 is smallest & l1 is largest.\n*/\n\n    int minimizeSum(vector<int>& nums) {\n        int s1 = INT_MAX, s2 = INT_MAX, s3 = INT_MAX, l1 = 0, l2 = 0, l3 = 0;\n        for(auto n: nums){\n            if(s1 > n) { s3 = s2; s2 = s1; s1 = n; }\n            else if(s2 > n) { s3 = s2; s2 = n; }\n            else if(s3 > n) { s3 = n; }\n\n            if(l1 < n) { l3 = l2; l2  = l1; l1 = n; }\n            else if(l2 < n ) { l3 = l2; l2 = n; }\n            else if(l3 < n ) { l3 = n; }\n        }\n        return min({l1 - s3, l3 - s1, l2 - s2});\n    }\n```\n\nHere is an article of my recent interview experience - A Journey to FAANG Company, I recomand you to go through this to know which all resources I have used & how I cracked interview at Amazon:\nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted
['C++']