✅  С | Sorted and compare
Complexity\n- Time complexity: O(N * logN)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(N)\n Add your space complexity here, e.g. O(n) \
# Complexity\n- Time complexity: O(N * logN)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nint min(int a, int b) {\n    if (a < b) return a;\n    else return b;\n}\n\nint cmp(const void *a, const void *b) {\n     return *(int*)a - *(int*)b;\n}\n\nint minimumDifference(int* nums, int numsSize, int k){\n    if (k == 1) return 0;\n\n    qsort(nums, numsSize, sizeof(int), cmp);\n\n    int result = 1000000;\n    for (int i = 0; i <= numsSize - k; i++) {\n        result = min(nums[i + k - 1] - nums[i], result);\n    }\n    \n    return result;\n}\n```
['C', 'Sorting', 'C++']