Question bank › Stack
Dsa Stack Warm-up

The Loading Dock

A warehouse uses a Last-In-First-Out (LIFO) stack for crates. You are given a series of logs: 'IN id' means a crate with a specific integer ID was loaded onto the stack, and 'OUT' means the top crate was removed. Your task is to output the ID of the crate that is removed during each 'OUT' operation. If 'OUT' is called on an empty stack, print 'EMPTY'. Example: Input: IN 101, IN 102, OUT, IN 103, OUT Output: 102 103

Key concepts

stackvalidation

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.