FastPrepMin Stack
Problems/Min Stack

Min Stack

ZipRecruiter logoZipRecruiter● MediumNEW GRADONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter onsite report asks candidates to implement and run a stack that supports ordinary stack operations and current-minimum lookup. It does not preserve method names, an operation-stream wrapper, bounds, examples, or source-image bytes, so this practice version supplies those interface details.

For this practice version, exercise the stack through the operation stream below.

Process operations on a stack that can return its current minimum in constant time.

  • push x pushes integer x and produces no output.
  • pop removes and returns the top value.
  • top returns the top value without removing it.
  • getMin returns the smallest value currently in the stack.

Return the outputs of every operation except push, in encounter order.

Function

processMinStack(operations: String[]) → int[]

Examples

Example 1

operations = ["push -2","push 0","push -3","getMin","pop","top","getMin"]return = [-3,-3,0,-2]

The minimum becomes -3. Popping returns -3, exposing top 0 and minimum -2.

Example 2

operations = ["push 2","push 2","getMin","pop","getMin"]return = [2,2,2]

Duplicate minima are tracked independently, so one pop leaves the same minimum.

Constraints

  • 1 <= operations.length <= 10^5.
  • Pushed values are 32-bit signed integers.
  • Every pop, top, and getMin operation is issued on a nonempty stack.

More ZipRecruiter Onsite Interview questions

  • Restaurant Vote LeadersPHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2026
  • Sliding Window Rate LimiterOA · ONSITE INTERVIEW · Seen Oct 2022
  • Sort an Integer Array in Ascending OrderOA · ONSITE INTERVIEW · Seen Apr 2022
  • Classify an Alien Dictionary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
  • Add Numbers Stored in Four-Digit ChunksONSITE INTERVIEW · Seen Nov 2021
  • Add Two Numeric Strings with CarryONSITE INTERVIEW · Seen Nov 2021
  • Expand Decimal Digits into Runs of OnesONSITE INTERVIEW · Seen Nov 2021
  • Solve a Sudoku BoardONSITE INTERVIEW · Seen Aug 2021
  • Validate a Sudoku BoardONSITE INTERVIEW · Seen Aug 2021
  • Iterate Ragged Integer Lists VerticallyONSITE INTERVIEW · Seen May 2017

Similar questions at other companies

  • KV Store with Nested TransactionsApplied Intuition · PHONE SCREEN · ONSITE INTERVIEWApplied Intuition interview questions
  • Min StackDP World · ONSITE INTERVIEW
  • Code Editor FoldingJane Street · ONSITE INTERVIEWJane Street interview questions
  • Undo and Redo Command HistoryNetflix · ONSITE INTERVIEWNetflix interview questions
  • Min StackMicrosoft · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
  • Text Document HistoryNotion · PHONE SCREEN · ONSITE INTERVIEWNotion interview questions
  • Equity Price History with O(1) StatisticsBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Nested Transaction Key-Value StorexAI · ONSITE INTERVIEWxAI interview questions
  • Transactional In-Memory RedisHashiCorp · ONSITE INTERVIEWHashiCorp interview questions
  • Key-Value Store with Nested TransactionsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int[] processMinStack(String[] operations) {
      // Write your code here.
    }
}
Checking account…