mysol
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)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npublic class Solution {\n    public int MinimumDifference(int[] nums, int k) {\n        if(nums.Length== 1 || k==1)\n        return 0;\n        int i=0;\n        int j=1;\n        int mindiff=1222344550;\n        Array.Sort(nums);\n        while(j<nums.Length)\n        {\n            if(j-i+1<k)\n            j++;\n            else\n            {\n                if((nums[j]-nums[i])<mindiff)\n                {\n                    mindiff= nums[j]-nums[i];\n                }\n                i++;\n                j++;\n            }\n\n        }\n\n        return mindiff;\n    }\n}\n```
['C#']