Opening your workspace…
Workspace/Coding room
Opening your workspace…
Help Gus serve the Friday crowd at the Stardrop Saloon. Read the villagers’ orders in arrival order. If Gus has every item on a ticket, he serves the whole order and takes those items from his stock. Otherwise, he sets the ticket aside and keeps all its items available for the next villager. How many orders can Gus serve?
{"Beer":2,"Pizza":1}, [["Beer"],["Pizza","Beer"],["Beer"]]Output2Gus pours one Beer for the first order and serves the Pizza with the last Beer for the second. The third order goes unfilled.
{"Salad":1}, [["Salad","Spaghetti"],["Salad"]]Output1Gus has no Spaghetti, so he sets aside the first ticket. The Salad is still available for the second.
Count each item on a ticket before removing anything from stock.
function solve(stock, orders) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.