Can't understand the question

Actually didn’t get the question please explain this if possible.

Link to the challenge:

Didn’t get there but seems like just a cash register.

You pay some “price” with some amount of “cash” and get “change” as return. Also you update array of “cid” or money that currently have the cash register.

If there are no money to get change, returns some object with “INSUFFICIENT_FUNDS”… and so on.

1 Like

lets see a test case

19.5, 20, [["PENNY", 1.01],
 ["NICKEL", 2.05],
 ["DIME", 3.1], 
["QUARTER", 4.25], 
["ONE", 90], 
["FIVE", 55],
 ["TEN", 20],
 ["TWENTY", 60],
 ["ONE HUNDRED", 100]])

 should return {status: "OPEN", change: [["QUARTER", 0.5]]}

why it is returning [[“QUARTER”,0.5" ]]?

Because is the “highest” like you should return 2xQUARTER or 2x0.25 $ = 0.50;

It ask for something like that “Otherwise, return {status: “OPEN”, change: […]}, with the change due in coins and bills, sorted in highest to lowest order, as the value of the change key.”

Also you can return 10xNICKEL or 50xPENNY but they are lower.

1 Like

awesome :smiley: thank you so much got my doubt cleared.