C++ | Easy | Simple
\nclass Solution {\npublic:\n    int minimumDifference(vector<int>& nums, int k) \n    {\n       sort(nums.begin(),nums.end(),greater<int>());  //sort\n   \n   
```\nclass Solution {\npublic:\n    int minimumDifference(vector<int>& nums, int k) \n    {\n       sort(nums.begin(),nums.end(),greater<int>());  //sort\n   \n       int ans=INT_MAX;\n\n       for(int i=0;i<nums.size();i++)\n       {\n          if(i<k)\n          {\n             if(i==(k-1))    //first actula size of the window\n             {\n                  ans=min(ans,nums[0]-nums[i]);\t\n             }\n          }\n          else\n          {\n             ans=min(ans,nums[i-k+1]-nums[i]);\n          }\n       }\n       return ans;      \n    }\n};\n```
['C', 'Sliding Window', 'C++']