Explanation of intuition
\n\n\nclass Solution {\npublic:\n    int minDifference(vector<int>& nums) {\n        int n = nums.size();\n        // If size is 4 then we can make 3 elements e
![image](https://assets.leetcode.com/users/images/185ce06a-c2ce-4ffe-8425-02ccce33edbe_1647332123.6982954.png)\n\n```\nclass Solution {\npublic:\n    int minDifference(vector<int>& nums) {\n        int n = nums.size();\n        // If size is 4 then we can make 3 elements equal to the\n        // 4th element and the difference will be 0.\n        // If size is less than 4 then we can make elements equal to\n        // each other and the difference will be 0\n        if (n <= 4) return 0;\n        \n        sort(nums.begin(), nums.end());\n        \n        return min({\n            nums[n-3] - nums[1],\n            nums[n-4] - nums[0],\n            nums[n-1] - nums[3],\n            nums[n-2] - nums[2]\n        });\n    }\n};\n```\n\nTime Complexity: O(nlogn)
['Greedy']