Java solution | Linear Runtime (No sorting)
Please Upvote !!!\n\nclass Solution {\n    public long minimumMoney(int[][] transactions) {\n        long spend = 0, cost = 0, cashback = 0;\n\n        for (int
### **Please Upvote !!!**\n```\nclass Solution {\n    public long minimumMoney(int[][] transactions) {\n        long spend = 0, cost = 0, cashback = 0;\n\n        for (int[] t : transactions) {\n            if (t[0] > t[1]) {\n                spend += t[0] - t[1];\n                cashback = Math.max(cashback, t[1]);\n            }\n            else cost = Math.max(cost, t[0]);\n        }\n\n        return spend + Math.max(cost, cashback);\n    }\n}\n\n// TC: O(n), SC: O(1)\n```
['Java']