Back to problems

Buffet Restaurant Entry/Exit Billing with Capacity Constraints

Algorithm · Upstart · Medium

Problem A buffet restaurant can seat at most capacity customers at any given time. You are provided with: capacity – the maximum occupancy of the restaurant. a[i] – the price customer i pays the first time they successfully enter. records – a list of customer IDs, in chronological order, each representing an event. Meaning of each record For id = records[t]: If customer id is currently outside, the event is an attempt to enter. If customer id is currently inside, the event…

Checking your access…