Company: Amazon_17may

Difficulty: medium

Problem Statement

Allocate limited inventory items based on priority algorithm. During a flash sale on Amazon, customers submit requests for a limited quantity of a product. Each of the request includes: [customerId, quantity, bidAmount, timestamp] . Items are allocated using these rules: Higher bids get priority. If multiple customers have the same bid, allocat e items in a round-robin manner based on the earliest timestamp until either all the inventory is allocated or the requests are fulfilled . A customer gets one item per round until their request is fulfilled. Return the IDs of customers who received no items. Note: Round-robin allocation means cycling through the tied customers in order of their timestamps, granting exactly one item to each customer per cycle, until either the inventory runs out or all their requested quantities are fulfilled. Example Input: requests = [[1, 5, 5, 0], [2, 7, 8, 1], [3, 7, 5, 1], [4, 10, 3, 3]] totalInventory = 18 Output: [4] Explanation: The first three requests

More Amazon_17may OA questionsInterview experiences