JS Solution - 2-pointer
LOL did the hints just mention binary search for this problem? I\'m gonna cry.\n\n# Complexity\n- Time complexity: O(nlogn)\n- Space complexity: O(1)\n\n# Code\
LOL did the hints just mention binary search for this problem? I\'m gonna cry.\n\n# Complexity\n- Time complexity: $$O(nlogn)$$\n- Space complexity: $$O(1)$$\n\n# Code\n```js\n/**\n * @param {number[]} nums\n * @param {number} k\n * @return {number}\n */\nvar maxFrequencyScore = function (nums, k) {\n  let n = nums.length;\n  nums.sort((a, b) => a - b);\n  let l = 0;\n  let r = 0;\n  let m = 0;\n\n  let s = 0;\n  let res = 0;\n\n  for (; r < n; ++r) {\n    m = (l + r) >> 1;\n    s += nums[r] - nums[m];\n    while (s > k) {\n      m = (l + r + 1) >> 1;\n      s -= nums[m] - nums[l];\n      ++l;\n    }\n\n    res = Math.max(res, r - l);\n  }\n\n  return res + 1;\n};\n```
['Array', 'Two Pointers', 'Greedy', 'JavaScript']