O(n) | Easy to Understand | Golang
Suppse max1, max2, max3 represent the three largest numbers, and min1, min2 and min3 represent the three smallest numbers. By modifying two elements in the arra
Suppse max1, max2, max3 represent the three largest numbers, and min1, min2 and min3 represent the three smallest numbers. By modifying two elements in the array. We can reduce the score to *min(max1 - min3, max3 - min1, max2 - min2)*\n\n# Code\n```\nfunc minimizeSum(nums []int) int {\n  max1, max2, max3 := math.MinInt32, math.MinInt32, math.MinInt32\n  min1, min2, min3 := math.MaxInt32, math.MaxInt32, math.MaxInt32\n  for _, num := range nums {\n    if num > max1 {\n      max3 = max2\n      max2 = max1\n      max1 = num\n    } else if num > max2 {\n      max3 = max2\n      max2 = num\n    } else if num > max3 {\n      max3 = num\n    }\n\n    if num < min1 {\n      min3 = min2\n      min2 = min1\n      min1 = num\n    } else if num < min2 {\n      min3 = min2\n      min2 = num\n    } else if num < min3 {\n      min3 = num\n    }\n  }\n  return min(min(max1 - min3, max3 - min1), max2 - min2)\n}\n\n\n```
['Go']