C++ Greedy
Approach: We paying for sum(cost-cashback) and we are taking maximum cashback as initial money because if we for last transaction we have money = cost[i]then we
**Approach**: We paying for **sum(cost-cashback)** and we are taking maximum cashback as initial money because if we for last transaction we have `money = cost[i] `then we will lost all the money so we taking intial money as cashback[i].\n\n```\nclass Solution {\npublic:\n    long long minimumMoney(vector<vector<int>>& transactions) {\n        long long res = 0;\n        for(auto ele: transactions){\n            res  = max(res,min(ele[0],ele[1])*1LL);\n        };\n        for(auto ele:transactions){\n            res+=max(ele[0]-ele[1],0);\n        };\n        return res;\n    }\n};\n```
['Greedy', 'C']