Company: Amazon_17may
Difficulty: medium
Inventory Allocation Priority Algorithm A flash sale has totalInventory identical items and receives n purchase requests. Request i is [customerId, quantity, bidAmount, timestamp] : the customer wants quantity items, offers bidAmount per item, and placed the request at time timestamp . Items are handed out with these rules: Requests with a higher bidAmount are served before requests with a lower one. A lower bid gets nothing until every higher bid has been completely filled. Requests that share the same bidAmount are served round-robin : go through them in order of increasing timestamp , give each one exactly one item per pass, and repeat the passes until each of them has its full quantity or the items run out. A request that is already full is skipped in later passes. Allocation stops as soon as the items run out. Complete the function getUnfulfilledCustomers(requests, totalInventory) , which returns the IDs of the customers who received no items at all , in ascending order. Input For