🥷🏻✔️ Time: O(nlogn), Space: O(1): Go, Javascript, PHP, Typescript 🔥🥷🏻
javascript []\nfunction minDifference(nums) {\n    if (nums.length <= 4) return 0;\n\n    nums.sort((a,b)=>a-b);\n\n    let result = Number.MAX_VALUE;\n    let 
```javascript []\nfunction minDifference(nums) {\n    if (nums.length <= 4) return 0;\n\n    nums.sort((a,b)=>a-b);\n\n    let result = Number.MAX_VALUE;\n    let n = nums.length;\n    let i = 0;\n\n    while (i <= 3) {\n        result = Math.min(result, nums[n - 4 + i] - nums[i]);\n        i++;\n    }\n\n    return result;\n};\n```\n```PHP []\nclass Solution {\n\n    /**\n     * @param Integer[] $nums\n     * @return Integer\n     */\n    function minDifference($nums) {\n        if (count($nums) <= 4) {\n            return 0;\n        }\n\n        sort($nums);\n\n        $result = INF;\n        $n = count($nums);\n        $i = 0;\n\n        while ($i <= 3) {\n            $result = min($result, $nums[$n - 4 + $i] - $nums[$i]);\n            $i++;\n        }\n\n        return $result;\n    }\n}\n```\n```Typescript []\nfunction minDifference(nums: number[]): number {\n    if (nums.length <= 4) return 0;\n\n    nums.sort((a,b)=>a-b);\n\n    let result: number = Number.MAX_VALUE;\n    let n: number = nums.length;\n    let i: number = 0;\n\n    while (i <= 3) {\n        result = Math.min(result, nums[n - 4 + i] - nums[i]);\n        i++;\n    }\n\n    return result;\n};\n```\n```Go []\nfunc minDifference(nums []int) int {\n    n := len(nums)\n    if n <= 4 {\n        return 0\n    }\n\n    sort.Ints(nums)\n\n    result := math.Inf(1)\n    i := 0\n\n    for i <= 3 {\n        result = math.Min(result, float64(nums[n-4+i]-nums[i]))\n        i++\n    }\n\n    return int(result)\n}\n```
['Go']