Stack with Instant Minimum

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

Design a stack that supports push, pop, reading the top, and returning the smallest value currently in the stack, all in constant time. Explain how you'd store the data and keep the minimum correct after pops.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →