Sorting solution for C# (explanation + complexity)
\n# Approach\n  \xA0 The partition will be minimized when the two consecutive elements in the source array have the minimum difference. This division will resul
\n# Approach\n  \xA0 The partition will be minimized when the two consecutive elements in the source array have the minimum difference. This division will result in the first sub-array having the maximum value, and the following element will be the minimum of the next sub-array.\n\xA0 To apply this approach, we need to sort the source array first and then successively check two elements to find the minimum difference.\n\n# Complexity\n- Time complexity: O(n * log(n))\n- Space complexity: O(1)\n\n# Code\n```\npublic class Solution {\n    public int MinPartitionValue(int[] nums)\n    {\n        System.Array.Sort(nums);\n\n        var minValue = int.MaxValue;\n\n        for (var i = 1; i < nums.Length; i++)\n        {\n            minValue = Math.Min(nums[i] - nums[i - 1], minValue);\n        }\n\n        return minValue;\n    }\n}\n```
['C#']