simplest javascript solution | O(n) time | O(1) space
Approach\n Describe your approach to solving the problem. \nFor each iteration do the following\n- if 5 dollar bill, increment variable c5 \n- if 10 dollar bill
# Approach\n<!-- Describe your approach to solving the problem. -->\nFor each iteration do the following\n- if 5 dollar bill, increment variable c5 \n- if 10 dollar bill, increment variable c10 and decrement c5\n- if 20 dollar bill, if 10 dollar bills exist, pay with one 10 and one 5. Otherwise pay with three 5\n\nAt the end of each iteration check if variable c5 or c10 is less than 0 ( return false )\n\n# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\n/**\n * @param {number[]} bills\n * @return {boolean}\n */\nvar lemonadeChange = function (bills) {\n    let c5 = 0\n    let c10 = 0\n    for(let i of bills){\n        if(i === 5)\n            c5 +=1\n        else if(i === 10){\n            c10 +=1\n            c5 -=1\n        }\n        else{ // 20\n            if(c10 != 0){\n                c10 -= 1\n                c5 -= 1\n            } else \n                c5 -= 3\n        }\n        if(c5 < 0 || c10 < 0) return false\n    }\n    return true;\n};\n```
['JavaScript']