🎊 Python | O(n log(n) ) | Sort and traverse  🎊
Solution \nPlease upvote if you liked it :)\n1. Here, we sort the array first : O(nlogn)\n2. Then we just look compare difference between:  [i-(k-1)] and [i] : 
# Solution \n**Please upvote if you liked it :)**\n1. Here, we sort the array first : O(nlogn)\n2. Then we just look compare difference between:  [i-(k-1)] and [i] : O(n)\n\nTotal complexity is O( n log(n) ) \n\n```\nclass Solution:\n    def minimumDifference(self, nums: List[int], k: int) -> int:\n        \n        if k == 1:\n            return 0\n        \n        nums.sort(reverse=True)\n        minDiff = inf\n        \n        for i in range(k-1, len(nums)):\n            d = nums[i-(k-1)] - nums[i]\n            if d < minDiff:\n                minDiff = d\n                \n        return minDiff\n        \n```
[]