Simple and fast solution || Easy to understand
Intuition\nTake the all maximum from each array one by one and then remove the (size of reward1 - k) element from total sum.\n\n# Approach\nFor removing we have
# Intuition\nTake the all maximum from each array one by one and then remove the (size of reward1 - k) element from total sum.\n\n# Approach\nFor removing we have to take the diff of both element and remove that element which have low diff.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& v1, vector<int>& v2, int k) {\n        int n1=v1.size();\n        int n2=v2.size();\n        vector<pair<int,int>>diff;\n        for(int i=0;i<n1;++i){\n            diff.push_back({v2[i]-v1[i],i});\n        }\n        sort(diff.begin(),diff.end());\n        int ans=0;\n        for(int i=0;i<k;++i){\n            ans+=v1[diff[i].second];\n        }\n        for(int i=k;i<n1;++i){\n            ans+=v2[diff[i].second];\n        }\n    \n        return ans;\n    }\n};\n```
['C++']