Simple | Easy | O(n) | C++ | if-else only
\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int a=0,b=0,c=0;\n        for(auto it: bills){\n            if(it==5) a++;\n            else if(it==10){\n                b++;\n                if(a==0) return false;\n                else a--;\n            }\n            else {\n                if(b!=0 && a>0){\n                    b--;\n                    a--;\n                }\n                else if(b==0 && a>=3){\n                    a-=3;\n                }\n                else{\n                    return false;\n                }\n                c++;\n            }\n        }\n        return true;\n    }\n};\n```
['C++']