My Greedy Solution || T(n): O(n) || S(n) = O(1)
Approach\nTo accept a tenDollarBill, we need at least one fiveDollarBill to give the customer correct change.\nTo accept a twentyDollarBill, we need to have eit
# Approach\nTo accept a tenDollarBill, we need at least one fiveDollarBill to give the customer correct change.\nTo accept a twentyDollarBill, we need to have either (tenDollarBill+fiveDollarBill) or (3 fiveDollarBills) to give the customer correct change.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int fiveBillCount=0,tenBillCount=0;\n        for(int bill:bills){\n            if(bill==5) fiveBillCount++;\n            else if(bill==10){\n                if(fiveBillCount>=1){\n                    tenBillCount++;\n                    fiveBillCount--;\n                }\n                else return false;\n            }\n            else{\n                if(tenBillCount>=1 and fiveBillCount>=1){\n                    tenBillCount--;\n                    fiveBillCount--;\n                }\n                else if(fiveBillCount>=3){\n                    fiveBillCount-=3;\n                }\n                else return false;\n            }\n        }\n        return true;\n    }\n};\n```
['Greedy', 'C++']