Min Stack
Medium
Stack
Design a stack that supports push x, pop, top and getMin, all in O(1). For every top and getMin operation print the result on its own line.
Constraints
1 <= q <= 3 * 10^4 -2^31 <= x <= 2^31 - 1 pop, top and getMin are only called on a non-empty stack
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.