sort and then check the consecutive diffs
The key point is that the minimum partition value is simply the smallest difference between any two elements.
Checking all possible pairs is nonsense and takes
The key point is that the minimum partition value is simply the smallest difference between any two elements.
Checking all possible pairs is nonsense and takes `O(N^2)`, if we first sort it, then we need to only compare consecutive diffs, reducing the complexity to: `O(NlogN)` - because of sort!, the single pass takes `O(n)`
```cpp []
class Solution {
public:
    int findValueOfPartition(vector<int>& nums) {
        sort(nums.begin(), nums.end());  
        int res = INT32_MAX;
        for (int i = 1; i < nums.size(); i++)
            res = min(res, nums[i] - nums[i - 1]);  
        return res;
    }
};
```
['C++']