Question bank › Stack
Dsa Stack Easy

Min Stack with Constant Time Retrieval

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the stack operations within a single class. Input Format: - The first line of input specifies the number of operations, followed by the operations which can be one of: - push x (where x is an integer) - pop - top - min Output Format: - For each top and min operation, print the resulting value. Example: Input: 6 push 3 push 5 min push 2 top pop min Output: 2 3 5

Key concepts

stackmindata structure

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.