This is a verified interview question from Wells-fargo. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Smart Fridge Inventory" covers key patterns like System Design.
"Implement a Smart Fridge Inventory of size capacity that supports two operations: * CONSUME(itemId): Retrieve and consume one unit of the specified item if present; otherwise, return -1. If consumed, decrement its quantity by 1. * STOCK(itemId, quantity): Insert or update the item with the given quantity. If the fridge has reached its capacity of unique items, remove the least consumed item. If multiple items have the same consumption frequency, remove the least recently consumed among them. Return an array of integers containing results for each CONSUME operation in order."
Join thousands of developers practicing for Wells-fargo.