[C] sort | Time: O(n * log n), Space: O(n)
C []\nstatic int cmp_int_asc(const int * const pThis, const int * const pBase){\n\treturn *pThis - *pBase;\n}\n\nint maxFrequency(\n\tint * const nums,\n\tconst
```C []\nstatic int cmp_int_asc(const int * const pThis, const int * const pBase){\n\treturn *pThis - *pBase;\n}\n\nint maxFrequency(\n\tint * const nums,\n\tconst int numsLen,\n\tconst int diff,\n\tconst int op\n){\n\tqsort(nums, numsLen, sizeof (int), &cmp_int_asc);\n\n\tint maxFreq = 0;\n\n\tfor (int i = 0, left = 0, right = 0; i < numsLen; ){\n\t\tint j = i;\n\t\twhile (j + 1 < numsLen && nums[j + 1] == nums[i]){\n\t\t\tj += 1;\n\t\t}\n\n\t\twhile (!( nums[i] - nums[left] <= diff )){\n\t\t\tleft += 1;\n\t\t}\n\t\twhile (right + 1 < numsLen && nums[right + 1] - nums[i] <= diff){\n\t\t\tright += 1;\n\t\t}\n\n\t\tint chanceToChange = (i - left) + (right - j);\n\t\tif (op < chanceToChange){\n\t\t\tchanceToChange = op;\n\t\t}\n\n\t\tconst int curFreq = (j + 1 - i) + chanceToChange;\n\t\tif (curFreq > maxFreq){\n\t\t\tmaxFreq = curFreq;\n\t\t}\n\n\t\ti = j + 1;\n\t}\n\n\tfor (int left = 0, right = 0; 1; left += 1){\n\t\twhile (right + 1 < numsLen && nums[right + 1] - nums[left] <= diff * 2){\n\t\t\tright += 1;\n\t\t}\n\n\t\tint chanceToChange = right + 1 - left;\n\t\tif (op < chanceToChange){\n\t\t\tchanceToChange = op;\n\t\t}\n\n\t\tconst int curFreq = chanceToChange;\n\t\tif (curFreq > maxFreq){\n\t\t\tmaxFreq = curFreq;\n\t\t}\n\n\t\tif (numsLen - 1 == right){\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn maxFreq;\n}\n```
['C']