Difference | Greedy | C++
\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) {\n        int n = reward1.size(), ans = 0;\n        vecto
```\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) {\n        int n = reward1.size(), ans = 0;\n        vector<vector<int>> v;\n        for(int i=0; i<n; i++) v.push_back({reward1[i] - reward2[i], reward1[i], reward2[i]});\n        sort(v.begin(), v.end(), greater<vector<int>>());\n        \n        for(int i=0; i<n; i++) {\n            if(k > 0) ans += v[i][1],  k--;\n            else ans += v[i][2];\n        }\n        return ans;\n    }\n};\n```
['Greedy', 'Sorting', 'C++']