Easy Sliding Window C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n.log(n))\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution {\npublic:\n    int minimumDifference(vector<int>& nums, int k) {\n        int n=nums.size();\n        sort(nums.begin(), nums.end());\n\n        int left=0, right=k-1;\n        int diff=INT_MAX;\n        int ans=INT_MAX;\n        while(right<n){\n            diff=nums[right]-nums[left];\n            ans=min(ans, diff);\n            left++;\n            right++;\n        }\n\n        return ans;\n    }\n};\n```
['Sliding Window', 'Python', 'C++', 'Java']