Super Easy Solution
Intuition:\nThe approach to solving this problem involves keeping track of the number of  5 and 10 bills we have in hand. Whenever a customer pays with a 5 bill
# Intuition:\nThe approach to solving this problem involves keeping track of the number of  5 and 10 bills we have in hand. Whenever a customer pays with a 5 bill, we simply increment the count of 5 bills. If a customer pays with a 10 bill, we decrement the count of $5 bills if available. If we don\'t have any 5 bills left at this point, we cannot provide change, so we return false. If the customer pays with a 20 bill, we first try to give change using a 10 bill and a 5 bill (if available) and then, as a fallback, three 5 bills. If we cannot provide change in either of these ways, we return false.\n\n# Algorithm:\nInitialize two variables, fives and tens, to keep track of the count of $5 and $10 bills, respectively.\nIterate through the bills array, and for each bill:\na. If the bill is $5, increment the fives count.\nb. If the bill is $10, increment the tens count and decrement the fives count by 1 (if available). If fives is zero at this point, return false.\nc. If the bill is $20:\nFirst, try to give change using a $10 bill and a $5 bill. Decrement both tens and fives counts by 1 (if available).\nIf we couldn\'t give change using the above step, try giving change using three $5 bills. Decrement fives count by 3 (if available).\nIf we still cannot give change, return false.\nIf we successfully provide change for all customers, return true.\nComplexity Analysis:\n\n# Time Complexity:\n The algorithm iterates through the bills array once, which takes O(n) time, where n is the number of customers.\n# Space Complexity:\n The algorithm uses two integer variables, fives and tens, which occupy constant space, so the space complexity is O(1).\nOverall, the algorithm has a linear time complexity of O(n) and a constant space complexity of O(1).\n\n\n\n\n\n# Code\n```\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int fives=0; int tens=0;\n        int n= bills.size();\n        for (int i=0; i<n; i++){\n            if (bills[i]==5)fives++;\n            if (bills[i]==10){\n                tens++;\n                if (fives==0)return false;\n                fives--;\n            }\n            if (bills[i]==20){\n                if (tens>0 && fives>0){\n                    tens--;\n                    fives--;\n                }\n                else if (fives>=3){\n                    fives-=3;\n                }\n                else return false;\n            }\n        }\n        return true;\n    }\n};\n```
['C++']