1984. Minimum Difference Between Highest and Lowest of K Scores

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1984

class Solution:
    def minimumDifference(self, nums: List[int], k: int) -> int:
        nums.sort()
        return min(nums[i + k - 1] - nums[i] for i in range(len(nums) - k + 1))