Dsa
Queue
Easy
Type-Batching Printer
A smart printer tries to save ink by batching jobs of the same document type. It takes the first job in the queue, then it looks ahead in the queue and pulls out up to 1 more job (total 2) of the SAME type to print together. The relative order of all other jobs must remain the same. This continues until the queue is empty. Print the job types in the order they were printed.
Example:
Input:
A B A A B C
Output:
A A B B A C
Key concepts
queuesearchbatch-processing
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now