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 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up