Easy C++ solution || Greedy approach
\n# Code\n\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int n = bills.size(), change5 = 0, change10 = 0;\n        for(int 
\n# Code\n```\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int n = bills.size(), change5 = 0, change10 = 0;\n        for(int i=0; i<n; i++){\n            if(bills[i] == 5){\n                change5++;\n            }\n            else if(bills[i] == 10){\n                if(change5 <= 0){\n                    return false;\n                }\n                change5--;\n                change10++;\n            }\n            else if(bills[i] == 20){\n                if(change10 > 0 && change5 > 0){\n                    change10--;\n                    change5--;\n                }\n                else if(change5 > 2){\n                    change5 -= 3;\n                }\n                else{\n                    return false;\n                }\n            }\n            if(change5 < 0 && change10 < 0){\n                return false;\n            }\n        }\n\n        return true;\n    }\n};\n```
['Array', 'Greedy', 'C++']