Lemonade Change

Try to solve the Lemonade Change problem.

Statement

At a lemonade stand, one lemonade costs 5€5. Customers are standing in line to buy lemonade can order one at a time. Each customer will buy only one lemonade and pay with a 5€5, 10€10, or 20€20 bill. You need to provide the correct change to each customer so that the net transaction is completed successfully with a total payment of 5€5. Initially, you do not have any change available.

Return TRUE if you can provide every customer with the correct change. Otherwise, return FALSE.

Constraints:

  • 11 \leq bill.length 103\leq 10^3
  • bill[i] is either 55, 1010, or 2020.

Examples

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.