Functional JavaScript | 1-liner | (b,f=0,t=0)=>b.every(x=>x==5?++f:(x==10?++t:t?--t:f-=2,f-->0))
Intuition\nKeep track of number of $5 and $10 that we have.\nFor every $20 first give $10, and only if out of $10, give 3 $5.\nIf we don\'t have bills to give, 
# Intuition\nKeep track of number of `$5` and `$10` that we have.\nFor every `$20` first give `$10`, and only if out of `$10`, give 3 `$5`.\nIf we don\'t have bills to give, return false.\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nlemonadeChange=(b,f=0,t=0)=>b.every(x=>x==5?++f:(x==10?++t:t?--t:f-=2,f-->0))\n```\n\nExpanded:\n```\nlemonadeChange=(\n    bills,\n    fives=0,\n    tens=0\n)=>bills.every(bill=>\n    bill==5\n        ?++fives\n        :(\n            bill==10\n                ?++tens\n                :tens>0\n                    ?--tens\n                    :fives-=2,\n            // there was enough $5 bills to give a change\n            fives-- > 0\n        )\n)\n```
['JavaScript']