Best Easy approach || 96.84% Beat || Python
Intuition\nSorting\n\n# Approach\nSliding Window\n\n# Complexity\n- Time complexity:\nO(NlogN)\n\n- Space complexity:\nO(K)\n\n# Code\n\nimport math\nclass Solu
# Intuition\nSorting\n\n# Approach\nSliding Window\n\n# Complexity\n- Time complexity:\nO(NlogN)\n\n- Space complexity:\nO(K)\n\n# Code\n```\nimport math\nclass Solution:\n    def minimumDifference(self, nums: List[int], k: int) -> int:\n        lst=[]\n        res=math.inf\n        nums.sort()\n        for i in range(len(nums)-k+1):\n            lst=nums[i:i+k]\n            res=min(res,lst[-1]-lst[0])\n        return res\n```
['Python3']