C++ || Sorting on difference || O(nlogn)
Intuition\nWe have to take the maximum gain we can have, which means maximizing the k rewards from the first mouse and minimizing those rewards from the second 
# Intuition\nWe have to take the **maximum gain** we can have, which means maximizing the k rewards from the first mouse and minimizing those rewards from the second mouse reward, which means we have to maximize the difference between the rewards of the two mice.\n\n# Approach\nSimply sorting according to the profit i.e, **reward1[i] - reward2[i]** will do the trick.\n\n# Complexity\n- Time complexity:\n$$O(nlogn)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\nclass Solution {\npublic:\n    //in case of tie in difference \n    //we choose the smaller one of the 2nd reward to be ommited \n    static bool cmp(pair<int, int> &a, pair<int, int> &b){        \n        if(a.first - a.second == b.first - b.second) return a.second < b.second;\n        return a.first - a.second > b.first - b.second;\n    }\n    int miceAndCheese(vector<int>& r1, vector<int>& r2, int k) {\n        vector<pair<int, int>> vp;\n        int n = r1.size();\n        for(int i=0; i < n; i++)\n            vp.push_back({r1[i], r2[i]});        \n        \n        sort(vp.begin(), vp.end(), cmp);\n        int ans = 0;\n        for(int i=0; i<n; i++){\n            if(i < k) ans += vp[i].first;  //for the first k rewards         \n            else ans += vp[i].second;   //next k            \n        }\n        \n        return ans;\n        \n    }\n};\n```
['Greedy', 'Sorting', 'C++']