---
# System prepended metadata

title: 2740. Find the Value of the Partition
tags: [Leetcode, Sorting, Medium, Greedy]

---

Link: https://leetcode.com/problems/find-the-value-of-the-partition/description/
## 思路
先排序 然后找到相邻的并且差最小的两个数 就是分割点
## Code
```python=
class Solution:
    def findValueOfPartition(self, nums: List[int]) -> int:
        nums.sort()
        minDiff = math.inf
        for i in range(1, len(nums)):
            if minDiff>nums[i]-nums[i-1]:
                minDiff = nums[i]-nums[i-1]
        return minDiff
```