Back to problems

Multi-Level Warehouse Storage with Weighted Retrieval

Object-Oriented Programming · Ramp · Hard

You are building the in-memory core for an automated warehouse rack. The rack is made of num_levels horizontal shelves, indexed from 0 at the top down to num_levels - 1 at the bottom. Each shelf can hold at most capacity items. Every stored item has an integer item_id, an integer weight, and an integer timestamp indicating when it was inserted. An item has a limited lifetime of ttl: if it was inserted at time t, it is still live for a query at time q only while $$q = 1,…

Checking your access…