C++ Solution
\n# Code\n\nclass Solution {\npublic:\n    int minimumDifference(vector<int>& nums, int k) {\n        \n       sort(nums.begin(),nums.end());\n\n       int left
\n# Code\n```\nclass Solution {\npublic:\n    int minimumDifference(vector<int>& nums, int k) {\n        \n       sort(nums.begin(),nums.end());\n\n       int left=0,right=k-1;\n\n       int result =100000;\n\n       while(right<nums.size())\n       {\n           result=min(result,nums[right]-nums[left]);\n            \n           left++;\n           right++;\n\n       }\n\n       return result;\n    }\n};\n```
['Sorting', 'C++']