Beats 100% of solutions in TC
IntuitionSo we need to minimize max in num1 and min in num2. So the gap should be small. We can find this out by first sorting out the numbers and then finding
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
So we need to minimize max in num1 and min in num2. So the gap should be small. We can find this out by first sorting out the numbers and then finding out gaps in between them, and get minimum gap. The logic here is that based on the gap the larger among two would be the max in num1 and smaller among two will be the min in num2, i.e in that way num1 and num2 construction is possible. Hence, there is no reason for us to actually buld those two arrays 
# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(logn)

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
0(1)
# Code
```java []
class Solution {
    public int findValueOfPartition(int[] nums) {
        Arrays.sort(nums);
        int ans = nums[nums.length-1] - nums[nums.length-2];
        for(int i = nums.length-2; i >=1; i--)
        {
            ans = Math.min(ans,nums[i] - nums[i-1]);
        }
        return ans;
    }
}
```
['Java']