line sweep, orderedmap
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```cpp []\nclass Solution {\npublic:\n    int maxFrequency(vector<int>& nums, int k, int op) {\n        map<int, int> mp;\n        unordered_map<int, int> n;\n        for(int x : nums){\n            mp[max(x - k, 0)]++;\n            mp[x + k + 1]--;\n            mp[x] += 0;\n            n[x]++;\n        }\n\n        int res = 1, line = 0;\n        for(auto& [x, y] : mp){\n            line += y; \n            //n[x] represents the frequency without any operations\n            int p = line - n[x];\n            // no of operations \n            p = min(p, op);\n            //p = min(p, op) since we have limit on how many operations we could do\n            res = max(res, p + n[x]);\n            \n        }\n        return res;\n    }\n};\n```
['Ordered Map', 'Line Sweep', 'C++']