Customer Checkout Duration

Problem Overview

  • Process a stream of checkout events to determine and report when each customer leaves the store.
  • Input: N instructions—CustomerEnter, BasketChange, LineService (per line or all lines); Output: exit notifications (customer IDs) in correct order, breaking ties by lower line ID.
  • Context: supermarket lines; customers can’t switch lines, item increases send them to back, decreases keep position, zero items means immediate exit.
  • From Optiver interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: