Using sorting
Intuition\nSort the array to find two numbers with minimum difference in linear time\n\n# Approach\nFirst of all, we need to sort the array. After sorting, we c
# Intuition\nSort the array to find two numbers with minimum difference in linear time\n\n# Approach\nFirst of all, we need to sort the array. After sorting, we can find two numbers which have minimum absolute difference in linear time. If we find these two numbers which form absolute minimum difference, then we can conclude these numbers can be put in one of the arrays and we can return their absolute difference as the result.\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    public int findValueOfPartition(int[] nums) {\n        Arrays.sort(nums);\n        int result = 1000000000;\n        for (int i = 0; i < nums.length - 1; i++) {\n            result = Math.min(result, nums[i + 1] - nums[i]);\n        }\n        return result;\n    }\n}\n```
['Java']