Brute Force
\n\n# Code\n\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int n=bills.size();\n        int five=0,ten=0,twenty=0;\n       
\n\n# Code\n```\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int n=bills.size();\n        int five=0,ten=0,twenty=0;\n        for(int i=0;i<n;i++){\n            if(bills[i]==5){\n                five+=5;\n            }\n            if(bills[i]==10){\n                ten+=10;\n                if(five>=5){\n                    five-=5;\n                }\n                else{\n                    return false;\n                }\n            }\n            if(bills[i]==20){\n                twenty+=20;\n                if(ten>=10 && five>=5){\n                    ten-=10;\n                    five-=5;\n                }\n                else if(five>=15){\n                    five-=15;\n                }\n                else{\n                    return false;\n                }\n                \n            }\n        }\n        return true;\n    }\n};\n```
['C++']