Ugly O(n) or Simple and Sweet O(n *log n)   [Java]
Either \na) the array is short (4 or less elements) and you can affort in 3 move to change values, such the array has only 1 value\nb) for a longer array , if y
Either \na) the array is short (4 or less elements) and you can affort in 3 move to change values, such the array has only 1 value\nb) for a longer array , if you have it sorted :** [m-1][m-2] [m-3] [m-4]**[ middle of the array] **[M-4][M-3] [M-2][M-1]** and  you will replace some of the lower side of the array m-1 :m -4 or upper side of the array M-4-M-1. \nFor example if you replace k smallest elements and 3-k bigger elements  the spread (Max-min) of the array will be [M-1-(3-k)] -[m-1-k]\n\n```\nclass Solution {\n    public int minDifference(int[] nums) {\n        if (nums.length <=4) {return 0;}\n        Arrays.sort(nums);\n        int r = nums[nums.length-1] - nums[0];\n        for(int i=0;i<4;i++) {\n            r = Math.min(r, nums[nums.length-(4-i)] - nums[i]);\n        }\n        return r;\n    }\n}\n```\n\nO(n*log(n)) Complexity is steming from sorting,  but since only the 3 lowest and highes elements of the arrays need to be sorted , that can be done in O(n):\n1) select 4 smalles and highes elemenst with with `[quick select](https://en.wikipedia.org/wiki/Quickselect)`.\n2) sort  4 smallest/highest elements - wich is a constant time operation
[]