Back to problems

Inventory Allocation by Bid Priority

Algorithm · Amazon · Medium

Requirements Every request is represented as [customerId, quantity, bidAmount, timestamp], and totalInventory specifies the available stock. Apply the allocation policy in this sequence: Requests offering a larger bidAmount take precedence. For requests at an equal bidAmount, use round-robin sequencing ordered by ascending timestamp. If both bidAmount and timestamp are equal, preserve the requests' original input order. During one pass through that sequence, any customer may…

Checking your access…