Sort - Java O(N*logN) | O(1)
IntuitionSort then go over every two consecutive values, the left value is the max of left partition, the right value is the min of the right partition.Approach
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSort then go over every two consecutive values, the left value is the max of left partition, the right value is the min of the right partition.\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(N*logN)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int findValueOfPartition(int[] nums) {\n        Arrays.sort(nums);\n        int res = Integer.MAX_VALUE;\n        for (int i = 1; i < nums.length; i++)\n            res = Math.min(res, nums[i] - nums[i - 1]);\n        return res;\n    }\n}\n```
['Java']