Go greedy !
Approach\n\nWe will greedily pick those indices from reward1 which will incur more profit ultimately.\n        \n        Consider the example :\n        reward1
# Approach\n\nWe will greedily pick those indices from reward1 which will incur more profit ultimately.\n        \n        Consider the example :\n        reward1 = {3, 3}\n        reward2 = {3, 5}\n        k = 1\n\n        Hence we will be choosing indices which will make less loss (or more profit).\n        \n        reward1-reward2 = {0, -2}\n            It means,\n                if we choose index 0 -> it will incur 0 loss\n                if we choose index 1 -> it will incur -2 loss\n            Thus if we are allowed to choose a single index, we will be greedily choosing index 0. \n\n\n# Code\n```\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k, int ret = 0) {\n        int n = reward1.size(), sum = 0;\n        priority_queue<pair<int, int>>q;\n        for(int i = 0; i < n; i++)\n            q.push({reward1[i]-reward2[i], i});\n        \n        vector<bool>visited(n, false);   \n        while(k > 0){\n            int ind = q.top().second;\n            q.pop();\n            sum += reward1[ind];\n            visited[ind]=true;\n            k--;\n        }\n        for(int i=0;i<reward1.size();i++)\n            if(!visited[i])\n                sum+=reward2[i];\n        \n        return sum;\n    }\n};\n```
['C++']