Dart Solution
Code\n\nclass Solution {\n  int maxFrequencyScore(List<int> nums, int k) {\n    nums.sort();\n    int operation = 0, answer = 0;\n    int i = 0, j = 0;\n    whi
# Code\n```\nclass Solution {\n  int maxFrequencyScore(List<int> nums, int k) {\n    nums.sort();\n    int operation = 0, answer = 0;\n    int i = 0, j = 0;\n    while (j < nums.length) {\n      operation += nums[j] - nums[(i + j) ~/ 2];\n      while (operation > k) {\n        operation += nums[i] - nums[(i + j + 1) ~/ 2];\n        i++;\n      }\n      answer = max(answer, j - i + 1);\n      j++;\n    }\n    return answer;\n  }\n}\n```
['Dart']