Simplest O(N)  C++ straight forward solution with explanation
If we get 5$ then five++\nif we get 10$ then do five--\nif we get 20$ {\n      if(ten) ten--,five--;\n\t  else five -= 3;\n\t  }\n\t  lastly check if five < 0\n
If we get 5$ then five++\nif we get 10$ then do five--\nif we get 20$ {\n      if(ten) ten--,five--;\n\t  else five -= 3;\n\t  }\n\t  lastly check if five < 0\n\t  \n```\nclass Solution {\npublic:\n    bool lemonadeChange(vector<int>& bills) {\n        int five = 0;\n        int ten = 0;\n        for(int i = 0 ; i < bills.size() ; i++){\n            if(bills[i] == 5) five++;\n            if(bills[i] == 10) ten++,five--;\n            if(bills[i] == 20) {\n                if(ten)ten--,five--;\n                else five -= 3;\n            }\n            if(five < 0) return false;\n        }\n        return true;\n    }\n};\n```
['C']