✅Simple and Clear Python3 Code✅
\n### Explanation\n\nIntuition\nIf the length of nums is 4 or less, we can make all elements equal by removing up to three elements, resulting in a difference o
\n### Explanation\n\n**Intuition**\nIf the length of `nums` is 4 or less, we can make all elements equal by removing up to three elements, resulting in a difference of 0.\n\n**Approach**\n1. **Edge Case Handling**: If the length of `nums` is less than or equal to 4, return 0 immediately since we can remove enough elements to make the array equal.\n2. **Sort the Array**: Sorting the array helps in easily finding the minimum and maximum values after potential removals.\n3. **Calculate Possible Differences**: After sorting, consider the following four scenarios to remove elements such that the remaining array has the smallest difference between the maximum and minimum values:\n   - Remove the three smallest elements.\n   - Remove the two smallest elements and the largest element.\n   - Remove the smallest element and the two largest elements.\n   - Remove the three largest elements.\n4. **Return the Minimum Difference**: The minimum of the four calculated differences is the answer.\n\n### Complexity\n\n- **Time Complexity**: $$O(n \\log n)$$, where `n` is the length of `nums`, due to the sorting operation.\n- **Space Complexity**: $$O(1)$$, since no additional space proportional to the input size is used beyond the input and a few extra variables.\n\n# Code\n```\nclass Solution:\n    def minDifference(self, nums: List[int]) -> int:\n        n=len(nums)\n        if n<5:\n            return 0\n        nums.sort()\n        return min([nums[-1]-nums[3],nums[-2]-nums[2], nums[-3]-nums[1],nums[-4]-nums[0]])\n```
['Python3']