Question bank › Stack
Dsa Stack Warm-up

The Editor's Mistake

You are building a simplified text editor. The editor accepts two types of commands: 'WRITE X' (where X is a single character) and 'UNDO'. 'WRITE X' appends the character X to the buffer. 'UNDO' removes the last character currently in the buffer. If 'UNDO' is called on an empty buffer, nothing happens. Print the final state of the text buffer. Example: Input: WRITE A, WRITE B, UNDO, WRITE C Output: AC

Key concepts

stackstring manipulation

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.