 All Problems
Lemonade Change
easy
array
greedy
amazon

At a lemonade stand, each lemonade costs $5. Customers are standing in a queue paying with $5, $10, or $20 bills. You must provide change to every customer.

Given an integer array bills representing the bills paid by customers in order, return true if you can provide every customer with correct change, or false otherwise.

Example 1:

Input: bills = [5,5,5,10,20]
Output: true

Example 2:

Input: bills = [5,5,10,10,20]
Output: false

Constraints:

  • 1 <= bills.length <= 10^5
  • bills[i] is either 5, 10, or 20
Run to check your code against the sample cases, or submit to run every case