Lemonade Change
Try to solve the Lemonade Change problem.
We'll cover the following
Statement
At a lemonade stand, one lemonade costs . 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 , , or bill
. You need to provide the correct change to each customer so that the net transaction is completed successfully with a total payment of .
Initially, you do not have any change available.
Return TRUE if you can provide every customer with the correct change. Otherwise, return FALSE.
Constraints:
-
bill.length
bill[i]
is either , , or .
Examples
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.