Opening your workspace…
Workspace/Coding room
Opening your workspace…
Before opening, the brewery lays out one bag for each item on its packing list. The stock array lists the blend ID of each available bag, and orders lists one blend ID for every bag customers requested. A stock bag can cover only one matching order. Return an array with the same length and order as orders: put 0 when an unused matching bag is available, and 1 when a new bag must be roasted. Handle orders from left to right. A newly roasted bag goes directly to that order and is not added to stock.
[4,4,9], [4,9,4,4]OUTPUT[0,0,0,1]The first three orders use the two bags of blend 4 and one of blend 9. The last order needs a new bag.
[], [2,2,0]OUTPUT[1,1,1]No bags are stocked. Each order needs its own new bag, including the second order for blend 2.
Tab inserts two spaces. Press Escape, then Tab, to leave the editor. Press Control or Command and Enter to submit.
[4,4,9], [4,9,4,4][0,0,0,1]Public samples only. These checks do not award ranked points.
Walk through a solution, check its time and space costs, and compare it with yours.
Checking your progress…