Greedy Kotlin Lambda O(N log N)
Consider the sorted scenario, where the index of the nums is\n0 1 2 3 4 .... n-3, n-2, n-1\nWe need to find the min value of\n nums[n-1] vs nums[2]\n nums[n-2] 
Consider the sorted scenario, where the index of the nums is\n```0 1 2 3 4 .... n-3, n-2, n-1```\nWe need to find the min value of\n* `nums[n-1]` vs `nums[2]`\n* `nums[n-2]` vs `nums[1]`\n* `nums[n-3]` vs `nums[0]`\nThe commonality is `n-1-2 = n-3`, `n-2-1 = n-3` and `n-3-0 = n-3`. So we write the following lambda to find the `nums[n-3+it]` vs `nums[it]`\n\n```kotlin\nclass Solution {\n  fun minimizeSum(nums: IntArray): Int {\n    nums.sort()\n    return (0 until 3).map {\n      nums[nums.size - 3 + it] - nums[it]\n    }.minOrNull()!!\n  }\n}\n```\n
['Kotlin']