Problem
Lemonade costs $5. Customers pay in order, each with a single $5, $10 or $20 bill, given in bills. You start with no change at all. Return true if you can give every customer correct change.
Example 1
- Input
- bills = [5, 5, 5, 10, 20]
- Output
- true
Example 2
- Input
- bills = [5, 5, 10, 10, 20]
- Output
- false
- Why
- the last customer needs $15 and you only hold two $10s
Constraints
1 <= bills.length <= 10^5bills[i] is 5, 10 or 20.