Straight forward Java Solution: O(nlogn) time O(1) space
\nclass Solution {\n  public int minDifference(int[] nums) {\n    int length = nums.length;\n    if (length <= 4) {\n      return 0;\n    }\n    Arrays.sort(num
```\nclass Solution {\n  public int minDifference(int[] nums) {\n    int length = nums.length;\n    if (length <= 4) {\n      return 0;\n    }\n    Arrays.sort(nums);\n    int min = Integer.MAX_VALUE;\n    min = Math.min(min, nums[length - 1] - nums[3]);\n    min = Math.min(min, nums[length - 2] - nums[2]);\n    min = Math.min(min, nums[length - 3] - nums[1]);\n    min = Math.min(min, nums[length - 4] - nums[0]);\n    return min;\n  }\n}\n```
['Java']