Perform Queries

Problem Overview

  • Process q queries to manage a shipping queue, inserting package IDs and shipping groups of three in FIFO order.
  • Input: list of queries as ['INSERT', id] or ['SHIP','-']; Output: for each SHIP, three IDs in queue order or 'N/A' if fewer than three.
  • Queue starts empty; shipped groups must preserve original arrival order.
  • Real-world context: warehouse logistics and batch shipping of packages.
  • From Amazon 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: