FastPrepMin Stack
Problems/Min Stack

Min Stack

Microsoft logoMicrosoft● MediumFULLTIMEINTERNPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The Microsoft Senior Applied Scientist phone screen report names Min Stack and follow-ups that it does not describe. The report does not give the operations or the limits, so we use the usual Min Stack. Our version is about 85% the same as the reported question.

Process a sequence of operations on a stack that can report its current minimum. The stack starts empty.

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

Return one integer result for each pop, top, or getMin operation in encounter order. Support every operation in constant time. This is the standard Min Stack.

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 changes after pushing -3. Popping returns -3, then the minimum returns to -2.

Example 2

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

Duplicate minima are tracked independently; one pop still leaves minimum 2.

Example 3

operations = ["push 2147483647","push -2147483648","getMin","pop","getMin"]return = [-2147483648,-2147483648,2147483647]

Minimum tracking works across the full signed 32-bit value range.

Constraints

  • 1 <= operations.length <= 100000.
  • Each operation is one of push x, pop, top, or getMin.
  • x is a signed 32-bit integer.
  • Every pop, top, and getMin is issued when the stack is nonempty.

More Microsoft Phone Screen questions

  • Config Store with Priority OverridesPHONE SCREEN · Seen Nov 2026
  • Corporation Reporting LinesPHONE SCREEN · Seen Oct 2026
  • Random Forest Classifier from ScratchPHONE SCREEN · Seen Oct 2026
  • Least Recently Used CacheOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Greedy and Beam Sentence DecodingPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Top K Frequent ElementsPHONE SCREEN · Seen Sep 2026
  • 3SumPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Arithmetic Expression EvaluatorPHONE SCREEN · Seen Sep 2026
  • Employee Hierarchy Cycle and Depth AnalysisPHONE SCREEN · Seen Sep 2026
  • Most Visited String SectorsPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Billing Log with Undo and RedoReddit · PHONE SCREENReddit interview questions
  • KV Store with Nested TransactionsApplied Intuition · PHONE SCREEN · ONSITE INTERVIEWApplied Intuition interview questions
  • Min StackDP World · ONSITE INTERVIEW
  • Multiline Text Editor with Cursor MovementDatologyAI · PHONE SCREEN
  • Code Editor FoldingJane Street · ONSITE INTERVIEWJane Street interview questions
  • Layer History with Batch Undo and RedoFigma · OA · PHONE SCREENFigma interview questions
  • Stack with Constant-Time Middle QueriesAmazon · PHONE SCREEN
  • In-Memory Database with Transactions and SavepointsNextdoor · PHONE SCREENNextdoor interview questions
  • Undo and Redo Command HistoryNetflix · ONSITE INTERVIEWNetflix interview questions
  • Text Document HistoryNotion · PHONE SCREEN · ONSITE INTERVIEWNotion interview questions

Interview reports that mention this question

  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)

Microsoft interview experiences

  • Microsoft OA Questions, October 2026: 4 Experiences
  • Microsoft Experienced SWE Phone Screen: 1 Experience
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
  • Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public int[] processMinStack(String[] operations) {
        // Write your code here.
    }
}
Checking account…