C++ Simple Solution with Explanation | 100% Faster
kill 3 smallest elements\n2.  kill 3 biggest elements\n3. kill 1 biggest elements + 2 smallest elements\n4. kill 2 biggest elements + 1 smallest elements\n\ncla
1. kill 3 smallest elements\n2.  kill 3 biggest elements\n3. kill 1 biggest elements + 2 smallest elements\n4. kill 2 biggest elements + 1 smallest elements\n```\nclass Solution {\npublic:\n    int minDifference(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int n=nums.size();\n        if(n<=4){\n            return 0;\n        }\n        //1st\n        int res=nums[n-1]-nums[3];\n        //2nd\n        res=min(res,nums[n-4]-nums[0]);\n        //3rd\n        res=min(res,nums[n-2]-nums[2]);\n        //4th\n        res=min(res,nums[n-3]-nums[1]);\n        return res;\n        \n    }\n};\n```\n
['C', 'Sorting']